从字符串中删除变音符号(重音符号)。帮我解决

时间:2017-10-16 07:11:14

标签: c# asp.net

****错误:****  1.程序不包含适用于入口点的静态Main方法  2. Modifier static对此项无效  3.变量'RemoveDiactritics'已声明但从未使用过

class Program
{

        public static void Main(string[] args)

        {

            static String RemoveDiacritics(String s)


            {
                String normalizedString = s.Normalize(NormalizationForm.FormD);
                StringBuilder stringBuilder = new StringBuilder();

                for (int i = 0; i < normalizedString.Length; i++)
                {
                    Char c = normalizedString[i];
                    if (CharUnicodeInfo.GetUnicodeCategory(c) != UnicodeCategory.NonSpacingMark)
                        stringBuilder.Append(c);
                }

                return stringBuilder.ToString();
            }
        }
}

1 个答案:

答案 0 :(得分:1)

findViewbyid