|
Pages: [1]
|
 |
|
Author
|
Topic: Using parse to eliminate trailing spaces (Read 619 times)
|
|
jfdutcher
|
The funtion below is supposed to remove trailing spaces from any string variable presented to it.
It goes a long way but the bottom line is .......they are still there when the funtion returns to the calling point. What's missing ?
space-strip: func [var] [ digit: charset [#"0" - #"9"] alpha: charset [#"A" - #"Z" #"a" - #"z"] alphanum: union alpha digit reverse var parse/all var [" " skip alphanum copy/part var to end] reverse var ]
|
|
|
|
|
Logged
|
|
|
|
|
Graham
|
Try using complement ..
space: charset [ #" " ] nonspace: complement space parse/all "abcd " [ copy data some nonspace ]
|
|
|
|
|
Logged
|
|
|
|
|
Gabriele
|
BTW, do you know about TRIM ? >> help trim USAGE: TRIM series /head /tail /auto /lines /all /with str
DESCRIPTION: Removes whitespace from a string. Default removes from head and tail. TRIM is an action value.
ARGUMENTS: series -- (Type: series port)
REFINEMENTS: /head -- Removes only from the head. /tail -- Removes only from the tail. /auto -- Auto indents lines relative to first line. /lines -- Removes all line breaks and extra spaces. /all -- Removes all whitespace. /with str -- Same as /all, but removes characters in 'str'. (Type: char string)
|
|
|
|
|
Logged
|
|
|
|
|
jfdutcher
|
Clearly I don't know too much yet :-) :-)
But also clearly, either of these suggestions will make things right
Thank you.
John D.
|
|
|
|
|
Logged
|
|
|
|
|
Graham
|
Oops .. I assumed that you knew about trim and wanted to learn how to do it using parse!
|
|
|
|
|
Logged
|
|
|
|
|
|
Pages: [1]
|
|
|
 |