C# Replace Invalid Filename Characters – Programming, Pseudocode Example, C# Programming Example
General

C# Replace Invalid Filename Characters

Sometimes, I need to create files or folders directly, and use existing data to provide the file name.

That’s all about how to remove all special characters from String in C#. As I said, you can use Replace() method of String along with regular expression to get rid of unwanted characters. You can define characters you want or remove in the regular expression as shown in our example.

 

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.