Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Get a char out of a parameter

Status
Not open for further replies.

ozi2

Programmer
Sep 1, 2002
40
IL
Hi,
I get a variable in my url called strMonths,
which is a list of monthes seperated with @ sign.
(example: &strMonths=1@3@5@11@12)
I need to get these monthes into variables.
Is there a way to do this?

Any idea is welcome,
OZ
 
If the string format is consistant, just use a -SET with EDIT as follows:
-SET &MONTH1 = EDIT(&strMonths,'9');
-SET &MONTH2 = EDIT(&strMonths,'$$9');
-SET &MONTH3 = EDIT(&strMonths,'$$$$9');
-SET &MONTH4 = EDIT(&strMonths,'$$$$$$9');
 
Hi WFGuru,

No it's not consistant and it's a dynamic,
meaning I don't know how many monthes will be send.
The only thing I know is that "@" is used to seperate between them.

Thank's
OZ
 
In that case you can use the GETTOK and SUBSTR subroutines. GETTOK will find the position of the @ characters and then use SUBSTR to parse it.
 
This loop will get all of the values into variables

-SET &PARMSTR = '1@3@5@11@12';
-SET &CNTR = 1;
-REPEAT LOOP1 99 TIMES
-SET &MTH&CNTR.EVAL = GETTOK(&PARMSTR, 100, &CNTR, @, 2, 'A2');
-IF &MTH&CNTR.EVAL EQ ' ' THEN GOTO ENDLOOP;
-SET &CNTR = &CNTR + 1;
-LOOP1
-ENDLOOP
 
Thank you very much guys.
I didn't use GETTOK as needed.

OZ
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top