|
sniper.9mm Newbie
Joined: 30 Mar 2005 Posts: 1
|
Posted: Wed Mar 30, 2005 2:46 pm
#FUNCTION argument problem? |
Hi,
For a script on processing items I was looking into writing a custom function that strips all spaces and special ascii characters from a given string. However, if you supply a string to the custom function with characters like " , - in them, the function doesn't work. Below is an example of what I am trying to do... I've already tried including them in extra brackets, or using %string() to force parsing a string etc...
#FU strip %subchar(%lower(%1), " ,.-", "")
and
item="testing The ~" this function, on - stripping?"
#EVAL @strip( @item ) gives:
testing the " this function, on - stripping?), "
While it _should_ produce:
testingthethisfunctiononstripping?
Also, using the " character in subchar seems to work odd..
Any ideas on this, or other solutions that will do the trick?
Thanx! |
|
|
|
Hazmeech Novice
Joined: 27 Mar 2005 Posts: 31
|
Posted: Wed Mar 30, 2005 4:28 pm |
I was playing around with it and got lucky.
You forgot a " in your list1 also
#CLASS {testdoc}
#ALIAS stripping {#EVAL @strip(item)}
#VAR strip {%subchar( %lower( @%-1), ",".-", "")}
#VAR item {testing The " this function, on - stripping?}
#CLASS 0 |
|
|
|
Hazmeech Novice
Joined: 27 Mar 2005 Posts: 31
|
Posted: Wed Mar 30, 2005 4:36 pm |
Or like this and if you type: strip item
it will strip the @item variable
#CLASS {testdoc}
#ALIAS strip {#EVAL @strip(%-1)}
#VAR strip {%subchar( %lower( @%-1), ",".-", "")}
#VAR item {testing The " this function, on - stripping?}
#CLASS 0 |
|
|
|
Hazmeech Novice
Joined: 27 Mar 2005 Posts: 31
|
Posted: Wed Mar 30, 2005 4:44 pm |
update
change you subchar line to
%subchar( %lower( @%-1), ",".~-", "") |
|
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|