 <p>You can use String.Replace Method:-</p> <pre><code>filename = filename.Replace(" ","").Replace("(","").Replace(")","").Replace(".",""); </code></pre> <p>You can wrap this inside an extension method like this:-</p> <pre><code>public static class StringExtention { public static string RemoveUnwantedCharacters(this string s) { StringBuilder sb = new StringBuilder(s); sb.Replace("(", ""); sb.Replace(")", ""); sb.Replace(" ", ""); sb.Replace(".", ""); return sb.ToString(); } } </code></pre> <p>You can use this as: <code>filename = filename.RemoveUnwantedCharacters();</code></p> <p>But, since there is a possiblity of whitespaces too and not just space, I guess Regex is the best answer here as answered by @JonSkeet :)</p>