×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Get a char out of a parameter

Get a char out of a parameter

Get a char out of a parameter

(OP)
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

RE: Get a char out of a parameter

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');

RE: Get a char out of a parameter

(OP)
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

RE: Get a char out of a parameter

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.  

RE: Get a char out of a parameter

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

RE: Get a char out of a parameter

(OP)
Thank you very much guys.
I didn't use GETTOK as needed.

OZ

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close