Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

UpperCase Function Without French Accents

DZone's Guide to

UpperCase Function Without French Accents

·
Free Resource

/// 
/// Returns a copy of a string in uppercase, without accents
/// 
/// Valid string expression
/// 
  
   String converted to uppercase
  
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:

/// 
/// Returns a copy of a string in lowercase, without accents
/// 
/// Valid string expression
/// 
  
   String converted to lowercase
  
public static string lowerCase (string text) {
	return upperCase(text).ToLower();
}
Topics:

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}