[SR-Users] Modifying $pU

dotnetdub dotnetdub at gmail.com
Wed Sep 22 11:32:22 CEST 2010


On 21 September 2010 23:53, Daniel-Constantin Mierla <miconda at gmail.com>wrote:

>
>
> On 9/22/10 12:49 AM, Alex Balashov wrote:
>
>> On 09/21/2010 04:47 PM, dotnetdub wrote:
>>
>>  I also looked at using re.subst on $pU but can't get it to work.
>>>
>>> What is the best way to achieve what I'm trying to do?
>>>
>>
>> I would extract a substring based on length.  Intermediate (first)
>> variable 'pu_len' is required because transformations cannot be nested:
>>
>>   $var(pu_len) = $(pU{s.len}) - 1;
>>   $var(new_pi) = $(pU{s.substr,1,$var(pu_len)});
>>
> while this is correct, you can do it without computing the length:
> $var(new_pi) = $(pU{s.substr,1,0});
>
> - meaning is that when len param for transformation is 0, get substring
> from position param till the end of pv value.
>
> Cheers,
> Daniel
>
>  <http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users>
>


Thank you very much. Both ways work as expected.

Regards
Brian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20100922/f95199ab/attachment.htm>


More information about the sr-users mailing list