This code remove the special character from string value using c sharp. when i want to string value only the aliphatic and number. I trim the special character using the method.

private static string RemoveUseLess(string st)
        {
            char ch;
            for (int i = st.Length - 1; i >= 0; i--)
            {
                ch = char.ToUpper(st[i]);

                if ((ch < 'A' || ch > 'Z') &&
                    (ch < '0' || ch > '9'))
                {
                    st = st.Remove(i, 1);
                }
            }
            return st;
        }

0 comments

Related Posts Plugin for WordPress, Blogger...