- May
- 239
- 2
Can you define a function using FUNCTION that takes a variable number of arguments and then in the function definition process all of these arguments in some way?
I'd like to define functions like these:
- Will return all params starting with "/" and ignore the rest.
@switchargs[params]
- Will return all params NOT starting with "/" and ignore the rest.
@actionargs[params]
Example use:
echo %@switchargs[/n /e a1 a2 a3]
/n /e
echo %@actionargs[/n /e /y a1 /x a2]
a1 a2
Can that be done using a FUNCTION defined function?
I can't find an obvious way to loop over the arguments at least, and it does not seem as if TCC offers any filter-like function for the purpose.
I'd like to define functions like these:
- Will return all params starting with "/" and ignore the rest.
@switchargs[params]
- Will return all params NOT starting with "/" and ignore the rest.
@actionargs[params]
Example use:
echo %@switchargs[/n /e a1 a2 a3]
/n /e
echo %@actionargs[/n /e /y a1 /x a2]
a1 a2
Can that be done using a FUNCTION defined function?
I can't find an obvious way to loop over the arguments at least, and it does not seem as if TCC offers any filter-like function for the purpose.