[SR-Users] How to iterate comma separated string
Daniel-Constantin Mierla
miconda at gmail.com
Tue Jun 11 16:04:26 CEST 2013
On 6/11/13 3:54 PM, Alex Balashov wrote:
> Mino,
>
> Something like this should probably work:
>
> $var(x) = "1,2,3,4";
>
> $var(i) = 0;
>
> while(defined $(var(x){s.select,$var(i),,})) {
> ...
>
> $var(i) = $var(i) + 1;
> }
>
> If the 'defined' operator always results 'true' on the results of this
> transformation, then alternately this:
>
> while($(var(x){s.select,$var(i),,}{s.len}) > 0)
It should work testing if result is !=$null as well, I added an entry in
faq, anyone could jump and enhance the content with other options:
https://www.kamailio.org/wiki/tutorials/faq/main#how_to_iterate_through_the_ite
Cheers,
Daniel
--
Daniel-Constantin Mierla - http://www.asipto.com
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Kamailio Advanced Training, San Francisco, USA - June 24-27, 2013
* http://asipto.com/u/katu *
More information about the sr-users
mailing list