How to detect filename is invalid.

  • Thread starter Thread starter XingZheng
  • Start date Start date
X

XingZheng

Hi

Could you tell me how to get InvalidFilenameCharacter in C# like
Path.InvalidPathChars.



Thanks.
 
XingZheng said:
Hi

Could you tell me how to get InvalidFilenameCharacter in C# like
Path.InvalidPathChars.

You might do better to simply try to create the file, then catch any
exceptions which may be raised. That will cover problems with invalid file
name characters or anything else.
 
You could use Regular Expressions to look for invalid characters.

Greets.
 
Poolbeer (MCP) said:
You could use Regular Expressions to look for invalid characters.

That will fail as soon as the definition of "invalid" changes.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top