Re: Getting a particular word in a string
- Here is a clip that will parse a line into words (seperated by one or more spaces) and allow
any word to be addressed by its position.
It is based on Hugo's and Alec's suggestions.
^!Set %Line%=1 2 3 4 5
; Remove adjacent spaces
^!Set %Z%=^$StrPos(" ";^%Line%;False)$
^!If ^%Z% <> 0 ^!Set %Line%=^$StrReplace(" ";" ";"^%Line%";False;False)$
^!If ^%Z% <> 0 ^!Goto Loop
; Parse line by words and select any word by position
^!SetListDelimiter " "
^!INFO LineWords has ^%LineWords0% words; word 3 = ^%LineWords3%
[Non-text portions of this message have been removed]