Sign in to follow this  
Followers 0

Udf - _stringcanbefilename

1 post in this topic

Func _StringCanBeFileName($string)
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.

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
  Return 0

Reading the help file before you post... Not only will it make you look smarter, it will make you smarter.

Share this post

Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
Followers 0