NormalizeString Function

Nilesh Ghodekar edited this page Jan 15, 2016 · 8 revisions
Clone this wiki locally

Syntax

string NormalizeString(value:string, [substitutions:string])

Description

Normalizes the first string, first by replacing the character substitutions specified in the second string and then removing all diacritics using the .NET string normalization function.

Remarks

If the optional second parameter (substitution string) specified, it is ':' and '|' separated in the form oldString1:newString1|oldString2:newString2… e.g. "Å:AA|Ä:AE|Ö:OE|å:aa|ä:ae|ö:oe|ß:ss|æ:ae". The substitutions are case-sensitive, so you need to provide uppercase as well as lowercase substitutions.

Supported Version

2.14.611.0 and later

Examples

NormalizeString([//Target/AccountName])

Replace some Nordic umlauts and strip accents from everything else:

NormalizeString([//Target/StoreName], "Å:AA|Ä:AE|Ö:OE|å:aa|ä:ae|ö:oe|ß:ss|æ:ae")

in the example given above Åhléns will become AAhlens, where Å will be replaced with AA and é will get its accept stripped and will become just e.

Replace Cyrillic chars with Latin ones and strip accents from everything else, e.g. Czech chars.

NormalizeString([//Target/DisplayName], "А:A|Б:B|В:V|Г:G|Д:D|Е:E|Ё:Yo|Ж:Zh|З:Z|И:I|Й:Y|К:K|Л:L|М:M|Н:N|О:O|П:P|Р:R|С:S|Т:T|У:U|Ф:F|Х:Kh|Ц:Ts|Ч:Ch|Ш:Sh|Щ:Sch|Ъ:|Ы:Y|Ь:|Э:E|Ю:Yu|Я:Ya|а:a|б:b|в:v|г:g|д:d|е:e|ё:yo|ж:zh|з:z|и:i|й:y|к:k|л:l|м:m|н:n|о:o|п:p|р:r|с:s|т:t|у:u|ф:f|х:kh|ц:ts|ч:ch|ш:sh|щ:sch|ъ:|ы:y|ь:|э:e|ю:yu|я:ya")

in here, Мао Цзэдун will become Mao Tszedun.