Looking for a function in Blue Prism to replace non english characters with english characters.
Example:
Input: Andrés Chávez Output: Andres Chavez
Looking for a function in Blue Prism to replace non english characters with english characters.
Example:
Input: Andrés Chávez Output: Andres Chavez
I have a code prepared just for that :)
That's a C# code, with one input string and one output string. They are conveniently named "input" and "output".
string help = input.Normalize(System.Text.NormalizationForm.FormD);
System.Text.StringBuilder sb = new System.Text.StringBuilder();
for (int i = 0; i < help.Length; i++)
{
System.Globalization.UnicodeCategory uc =
System.Globalization.CharUnicodeInfo.GetUnicodeCategory(help[i]);
if (uc != System.Globalization.UnicodeCategory.NonSpacingMark)
{
sb.Append(help[i]);
}
}
output = sb.ToString().Normalize(System.Text.NormalizationForm.FormC);
That code requires namespace "System.Globalization". It needs to be added into Code Options of your business object. .
I hope you'll be able to get that working easy.
thanks to @Andrzej Kaczor from 2020! Code works perfectly. Just make sure that you use C# as language in your Object, you have System.Globalization namespaces imported as shown and you have input/output set in corresponding tabs in your Code stage.
Hey you could just do this. It replaces upper and lower case of some diacritic letters. I know it's not looking pretty. But it does what I want it to do.
textEdit1 = textEdit.Replace("ě","e").Replace("š","s").Replace("ř","r").Replace("č", "c").Replace("ž", "z").Replace("ý", "y").Replace("á", "a").Replace("í", "i").Replace("é", "e").Replace("ň", "n").Replace("ť", "t").Replace("ď", "d").Replace("Ě", "E").Replace("Š", "S").Replace("Č", "C").Replace("Ř", "R").Replace("Ž", "Z").Replace("Ý", "Y").Replace("Á", "A").Replace("Í", "I").Replace("É", "E").Replace("Ň", "N").Replace("Ť", "T").Replace("Ď", "D");