Find a char in string and replace new char using x++

Hi,

i want to replace character in my string

for exemle :

str a=“éàbttkù” to replace it automatically to eabttku

thank you

One approach is using general-purpose functions for replacing strings, e.g. strReplace() or TextBuffer.replace().

A completely different way is string normalization implemented by .NET String class. Removing Diacritics from Strings uses this approach.

i have try this :

static System.String RemoveAccentss(System.String input )
{
    System.Text.StringBuilder builder;
    System.String normalized ;
    System.Char c;
    int i;
    System.Text.NormalizationForm FormKD;

    normalized = input.Normalize(FormKD);
    builder = new  System.Text.StringBuilder();

   for (i = 0; i < strLen(normalized) ; i++)
    {
        c =  normalized[i];

        if (GetUnicodeCategory(c) !=
        UnicodeCategory.NonSpacingMark)
        {
            builder.Append(c);
        }
    }
    return builder.ToString();
}

can  you help me to develop it 

This is the correct conversion of the example linked above to X++:

System.String initial = 'ÁÂÃÄÅÇÈÉàáâãäåèéêëìíîïòóôõ';  
System.String normalized ;
System.Text.StringBuilder builder; 
System.Char c;
int i;
int length;
    
try
{
    normalized = initial.Normalize(System.Text.NormalizationForm::FormD);
    builder = new System.Text.StringBuilder(); 
    
    length = normalized.get_Length();
    for (i = 0; i < length; i++)
    {
        c = normalized.get_Chars(i);
        if (System.Globalization.CharUnicodeInfo::GetUnicodeCategory(c)
            != System.Globalization.UnicodeCategory::NonSpacingMark)
        {
            builder.Append(c);
        }
    }    
    info(initial);
    info(builder.ToString());
}
catch (Exception::CLRError)
{
    throw error(AifUtil::getClrErrorMessage());
}