Splitting a macro variable

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Splitting a macro variable

Max Bell-2
Dear listers,

In a macro I use variable !var. And actualy !var is a list of
STRING-variables which is set in the macro call:

!test var = 'var1 var2 var3 var4' .

I do this because the number of variables differs often and until now it
worked.

But now I need to compute something for each variable seperately like
- compute  var1='abc'.
- compute  var2='def'.
- etc...

So in the macro I need to split !var back into the original variables
var1, var2, etc. and then use these in compute-statements


Does anybody know how?

Thank you.

Max
Reply | Threaded
Open this post in threaded view
|

Re: Splitting a macro variable

Albert-Jan Roskam
Hi Max,

Is this what you're looking for? (var1 to var3 are
string variables).

do repeat #x = var1 to var3 / #y = "abc" "def" "ghi".
+ compute #x = #y.
end repeat print.
exe.

You could use !QUOTE in a macro if you don't want to
quote all the values, as in
+ compute #x = !quote(#y).

Cheers!
Albert-Jan



--- Max Bell <[hidden email]> wrote:

> Dear listers,
>
> In a macro I use variable !var. And actualy !var is
> a list of
> STRING-variables which is set in the macro call:
>
> !test var = 'var1 var2 var3 var4' .
>
> I do this because the number of variables differs
> often and until now it
> worked.
>
> But now I need to compute something for each
> variable seperately like
> - compute  var1='abc'.
> - compute  var2='def'.
> - etc...
>
> So in the macro I need to split !var back into the
> original variables
> var1, var2, etc. and then use these in
> compute-statements
>
>
> Does anybody know how?
>
> Thank you.
>
> Max
>


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com