flyingboz Posted March 10, 2004 Share Posted March 10, 2004 Func _StringCanBeFileName($string) #include-once #cs 2004.03.10 flyingboz Function to Determine whether $string can be used as a filename. Extend the contents of $illegal (space delimited) to exclude additional chars, if desired or needed. Returns -1 if $string contains a character in $illegal, 0 otherwise. #ce local $i local $Illegal local $loc_Illegal $loc_Illegal = 0 local $space $space = " " $illegal = '\ / : * ? " < > |' $illegal = StringSplit($illegal,$space) for $i = 1 to $illegal[0] $loc_Illegal = StringInStr($string,$illegal[$i]) if $loc_Illegal > 0 Then Return -1 endif next Return 0 EndFunc Reading the help file before you post... Not only will it make you look smarter, it will make you smarter. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now