Laszlo
Joined: 14 Feb 2005 Posts: 4078 Location: Pittsburgh
|
Posted: Mon Mar 07, 2005 5:39 pm Post subject: if name is varname |
|
|
It would be nice to be able to check with a single instruction if the content of a variable can be used to name a variable. The following code works, but it is long and if the set of allowed characters change, it has to be updated. | Code: | StringReplace var,Name, #, a, All
StringReplace var, var, _, a, All
StringReplace var, var, @, a, All
StringReplace var, var, $, a, All
StringReplace var, var, ?, a, All
StringReplace var, var, [, a, All
StringReplace var, var, ], a, All
if var is alnum ; check if Name can be a variable
NameError = 0
else
NameError = 1 |
|
|