c sharp

Remove Control Characters in c#

A
Desh-Duniya Team Author
| Published May 09, 2019
 public static string RemoveControlCharacters(string inString)
        {
            if (inString == null) return null;
            StringBuilder newString = new StringBuilder();
            char ch;
            for (int i = 0; i < inString.Length; i++)
            {
                ch = inString[i];
                if (!char.IsControl(ch))
                {
                    newString.Append(ch);
                }
            }
            return newString.ToString();
        }

Discussion (0)

Please sign in to participate in the discussion.
No comments yet. Be the first to join the conversation!