Esempio n. 1
0
 static StringsExtensions()
 {
     StringsExtensions.AddUnaccent("([ÀÁÂÃÄÅÆ])", "A");
     StringsExtensions.AddUnaccent("([Ç])", "C");
     StringsExtensions.AddUnaccent("([ÈÉÊË])", "E");
     StringsExtensions.AddUnaccent("([ÌÍÎÏ])", "I");
     StringsExtensions.AddUnaccent("([Ð])", "D");
     StringsExtensions.AddUnaccent("([Ñ])", "N");
     StringsExtensions.AddUnaccent("([ÒÓÔÕÖØ])", "O");
     StringsExtensions.AddUnaccent("([ÙÚÛÜ])", "U");
     StringsExtensions.AddUnaccent("([Ý])", "Y");
     StringsExtensions.AddUnaccent("([Þ])", "T");
     StringsExtensions.AddUnaccent("([ß])", "s");
     StringsExtensions.AddUnaccent("([àáâãäåæ])", "a");
     StringsExtensions.AddUnaccent("([ç])", "c");
     StringsExtensions.AddUnaccent("([èéêë])", "e");
     StringsExtensions.AddUnaccent("([ìíîï])", "i");
     StringsExtensions.AddUnaccent("([ð])", "e");
     StringsExtensions.AddUnaccent("([ñ])", "n");
     StringsExtensions.AddUnaccent("([òóôõöø])", "o");
     StringsExtensions.AddUnaccent("([ùúûü])", "u");
     StringsExtensions.AddUnaccent("([ý])", "y");
     StringsExtensions.AddUnaccent("([þ])", "t");
     StringsExtensions.AddUnaccent("([ÿ])", "y");
     StringsExtensions.AddUnaccent("([–])", "-");
     StringsExtensions.AddUnaccent("([!])", "");
 }
Esempio n. 2
0
 public static string Camelize(this string lowercaseAndUnderscoredWord)
 {
     return(StringsExtensions.Uncapitalize(StringsExtensions.Pascalize(lowercaseAndUnderscoredWord)));
 }
Esempio n. 3
0
 public static string Humanize(this string lowercaseAndUnderscoredWord)
 {
     return(StringsExtensions.Capitalize(Regex.Replace(lowercaseAndUnderscoredWord, "_", " ")));
 }
Esempio n. 4
0
 public static string Titleize(this string word)
 {
     return(Regex.Replace(StringsExtensions.Humanize(StringsExtensions.Underscore(word)), "\\b([a-z])", (MatchEvaluator)(match => match.Captures[0].Value.ToUpper())));
 }
Esempio n. 5
0
        public static string Sanitize(this string source)
        {
            if (string.IsNullOrEmpty(source))
            {
                return(source);
            }
            StringBuilder stringBuilder = new StringBuilder(source.Length);

            foreach (char ch in Enumerable.Where <char>((IEnumerable <char>)source, (Func <char, bool>)(c => StringsExtensions.IsLegalXmlChar((int)c))))
            {
                stringBuilder.Append(ch);
            }
            return(((object)stringBuilder).ToString());
        }
Esempio n. 6
0
 public static string ToUrl(this string urlWord)
 {
     urlWord = urlWord.Trim().Replace("..", ".").Replace("./", "/").Replace("-&-", "-").Replace("?.", ".");
     urlWord = StringsExtensions.UrlCleanRegEx.Replace(urlWord, "");
     return(StringsExtensions.Dasherize(StringsExtensions.Unaccent(urlWord)).ToLowerInvariant());
 }