At 3:40 PM -0700 8/24/99, [log in to unmask] wrote:
>i've got a little puzzler.... i've got a ci string variable
>that contains, depending on it's input value, 'n' words
>(where 'n' is >= 2 and < some reasonable number) separated
>by 'x' spaces (where 'x' is >= 1 and < some finite yet
>practical number). i'd like to reduce it to a string that
>would still contain 'n' words but where each word is
>separated by one space. 'repl' isn't exactly working....
>i'd rather not take the 'word' route since i'm unsure how
>many words are in the entire string. any
>ideas? - d
How about this...
setvar _test "this is a test string"
setvar w_count wordcnt(_test)
setvar i 0
setvar _temp ""
while setvar(i, i + 1) <= w_count
setvar _temp _temp + word(_test, ' ', i ) + ' '
endwhile
setvar _test _temp
You can "take the 'word' route" as long as you're on an MPE release that
has the wordcnt function.
Barry Lake [log in to unmask]
Allegro Consultants, Inc. www.allegro.com
(408)252-2330