Return to Snippet

Revision: 52312
at October 19, 2011 23:38 by hejaaa


Updated Code
function removeDiacritics(text:String, lowerCase:Boolean = false):String {
			var mapDi:String="áäàâčçďéěëèêíïîĺľňóôöŕšťúůüùûýřžÁÄÀÂČÇĎÉĚËÈÊÍÏÎĹĽŇÓÔŒÖŔŠŤÚŮÜÙÛÝŘŽ";
			var mapNo:String="aaaaccdeeeeeiiillnooorstuuuuuyrzAAAACCDEEEEEIIILLNOOSORSTUUUUUYRZ";
	var strOut:String="";
	lowerCase?text=text.toLocaleLowerCase():null;
	for (var i:uint = 0; i < text.length; i++) {
		if (mapDi.indexOf(text.charAt(i))!=-1) {
			strOut+=mapNo.charAt(mapDi.indexOf(text.charAt(i)));
		} else {
			strOut+=text.charAt(i);
		}
	}
	return strOut;
}

Revision: 52311
at October 19, 2011 23:37 by hejaaa


Updated Code
function removeDiacritics(text:String, lowerCase:Boolean = false):String {
	var mapDi:String="áäàâ�ç�é�ëèêíïîĺľ�óôö�šťúůüùûý�ž���������������ĹĽ������ŠŤ�Ů�����Ž";
	var mapNo:String="aaaaccdeeeeeiiillnooorstuuuuuyrzAAAACCDEEEEEIIILLNOOSORSTUUUUUYRZ";
	var strOut:String="";
	lowerCase?text=text.toLocaleLowerCase():null;
	for (var i:uint = 0; i < text.length; i++) {
		if (mapDi.indexOf(text.charAt(i))!=-1) {
			strOut+=mapNo.charAt(mapDi.indexOf(text.charAt(i)));
		} else {
			strOut+=text.charAt(i);
		}
	}
	return strOut;
}

Revision: 52310
at October 19, 2011 20:18 by hejaaa


Updated Code
function removeDiacritics(text:String, lowerCase:Boolean = false):String {
	var mapDi:String="áäàâčçďéěëèêíïîĺľňóôöŕšťúůüùûýřžÁÄÀÂČÇĎÉĚËÈÊÍÏÎĹĽŇÓÔŒÖŔŠŤÚŮÜÙÛÝŘŽ";
	var mapNo:String="aaaaccdeeeeeiiillnooorstuuuuuyrzAAAACCDEEEEEIIILLNOOSORSTUUUUUYRZ";
	var strOut:String="";
	lowerCase?text=text.toLocaleLowerCase():null;
	for (var i:uint = 0; i < text.length; i++) {
		if (mapDi.indexOf(text.charAt(i))!=-1) {
			strOut+=mapNo.charAt(mapDi.indexOf(text.charAt(i)));
		} else {
			strOut+=text.charAt(i);
		}
	}
	return strOut;
}

Revision: 52309
at October 19, 2011 20:01 by hejaaa


Initial Code
function removeDiacritics(text:String, lowerCase:Boolean = false):String {
	var mapDi:String="áäčďéěíĺľňóô öŕšťúů üýřžÁÄČĎÉĚÍĹĽŇÓÔ ÖŔŠŤÚŮ ÜÝŘŽ";
	var mapNo:String="aacdeeillnoo orstuu uyrzAACDEEILLNOO ORSTUU UYRZ";
	var strOut:String="";
	lowerCase?text=text.toLocaleLowerCase():null;
	for (var i:uint = 0; i < text.length; i++) {
		if (mapDi.indexOf(text.charAt(i))!=-1) {
			strOut+=mapNo.charAt(mapDi.indexOf(text.charAt(i)));
		} else {
			strOut+=text.charAt(i);
		}
	}
	return strOut;
}

Initial URL

                                

Initial Description
remove diacritics with the possibility convert to lowercase

Initial Title
Remove diacritics

Initial Tags

                                

Initial Language
ActionScript 3