> Is there an easy way to test a directory name for invalid characters
> before trying to create that directory? I know how to get a
> character array of invalid characters (Path.GetInvalidPathChars) but
> do I have to go to all of the trouble of writing of my validation
> method or is there something built in to the .NET Framework that I
> haven't found yet?
string path = "....";
if (path.IndexOfAny(Path.GetInvalidPathChars()) >= 0)
{
// path contains invalid characters
}
-cd
Dave - 29 Jul 2006 20:46 GMT
Thanks. Originally I was thinking that I wanted a method to eliminate
invalid characters from the path string (the string was actually the name of
something else unrelated to a path) but now I think I'll just prohibit those
characters from the original string.
>> Is there an easy way to test a directory name for invalid characters
>> before trying to create that directory? I know how to get a
[quoted text clipped - 10 lines]
>
> -cd