开发者

How to replace a specific text by another in Response in asp.net

fro globalization for arabian contries I wa开发者_C百科nt to show digits to arabic ones.such as 1--> ۱ ,2--> ۲ ,3-->۳ ....

Is there any way to replace a specific text by another at response?

thanks


public static string ToArabic(string input, string cultureName)
{
    CultureInfo culture= new CultureInfo(cultureName);
    var arabicDigits = culture.NumberFormat.NativeDigits;
    for (int i = 0; i < arabicDigits.Length; i++)
    {
       input = input.Replace(i.ToString(), arabicDigits[i]);
    }
    return input;
}

take client culture(e.g. "fa-IR") and pass it to above method

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜