DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
UpperCase Function Without French Accents
/// <summary>
/// Returns a copy of a string in uppercase, without accents
/// </summary>
/// <param name="text">Valid string expression</param>
/// <returns>String converted to uppercase</returns>
public static string upperCase (string text) {
const string accents = "�ÀÄÂÉÈËÊ�Ì�ÎÓÒÖÔÚÙÜÛŸÇ";
const string normaux = "AAAAEEEEIIIIOOOOUUUUYC";
string majuscules = text.ToUpper();
for (int i = 0; i < accents.Length; i++) {
majuscules = majuscules.Replace(accents.Substring(i, 1), normaux.Substring(i, 1));
}
majuscules = majuscules.Replace("Æ", "AE");
majuscules = majuscules.Replace("Å’", "OE");
return majuscules;
}
And:
/// <summary>
/// Returns a copy of a string in lowercase, without accents
/// </summary>
/// <param name="text">Valid string expression</param>
/// <returns>String converted to lowercase</returns>
public static string lowerCase (string text) {
return upperCase(text).ToLower();
}




