Barry Lake wrote:
> At 5:08 PM -0400 9/26/00, [log in to unmask] wrote:
> >How do I break this up into 3 different variable TEMPVAR1, TEMPVAR2,
> >TEMPVAR3 such that the results should be as follows:
> >
> >Is there any option other than involving a WHILE loop with continious read
> >till I reach "." in each attempt and process it accordingly. Any better,
> >fast and best ideas ? Thanks in advance.
>
> How about
>
> :setvar tempvar "[log in to unmask]"
> :setvar tempvar1 word(tempvar,'.',1)
> :setvar tempvar2 word(tempvar,'.',2)
> :setvar tempvar3 word(tempvar,'.',3)
> :showvar temp@
> TEMPVAR = [log in to unmask]
> TEMPVAR1 = AI@J
> TEMPVAR2 = GROUP1
> TEMPVAR3 = ACCOUNT1
i think using word is the correct approach but it all depends on just how
sophisticated the script needs to be. the original question implied there
would always be three 'things' to extract -- but what if there's only two or
one? i don't have time to work this out at the moment...but i should think
some sort of loop using word (to extract individual pieces) and xword to remove
the piece just extract from the original string would be desireable and more
flexible. in untested, off-the-top-of-my-head code :-), something like....
setvar i 0
while !orig_string > ""
setvar i i+1
setvar temp word(!orig_string,'.',i)
if temp>""
setvar temp!i temp
endif
setvar orig_string xword(!orig_string,".")
endwhile
in this case 'temp' is trash. it's just a place to hold the extracted word.
temp1, temp2...tempn -- those are the pieces extracted from the original
string. (that's a beautiful thing (imo) -- the ability to name/create a
variable that creates a variable. thanks, jeff :-) - d
--
Donna Garverick Sr. System Programmer
925-210-6631 [log in to unmask]
>>>MY opinions, not Longs Drug Stores'<<<
|