[Users] strip_tail() string length?

Daniel-Constantin Mierla daniel at voice-system.ro
Tue Jan 30 11:57:11 CET 2007


Hello,

On 01/30/07 08:00, Juha Heinanen wrote:
> Brandon Armstead writes:
>
>  >     I'm wondering what the easiest method would be to grab how long the RURI
>  > is and strip based on that information... or would I have to actually use
>  > regex, or is there an easier STRLEN() or LENGTH() operation?  Any ideas, or
>  > is this something that could be implemented?  Thanks.
>
> i too have been thinking that regex is an overkill for tests like
> this:
>
> if (uri=~"^sip:\+") ...
>
> a php like substr function might be faster.  so instead of the above or
>
>  > i.e. strip_tail(strlen($ru) - 2); ... or something like such.
>
> how about
>
> if (substr(uri, 0, 5) == "sip:+") ...
>
> or
>
> substr($ru, -2, 2)
>
> by the way, i didn't notice == operator in the summary.  should i write
> the above if as
>
> switch(substr(uri, 0, 5)) {
>   case "sip:+": ...
>   default: ...
> }
>
> instead or is == supported?
>   
== is supported in the new 1.2.0. All old operators that could be used 
in IF conditions can be used now with any pseudo-variable:

== - equal match
!= - not equal match
=~ - regexp match
!~ - not regexp match (this is NEW)

if($rU=="1234") is true if r-uri username is '1234'.

Cheers,
Daniel

> -- juha
>
> _______________________________________________
> Users mailing list
> Users at openser.org
> http://openser.org/cgi-bin/mailman/listinfo/users
>
>   




More information about the sr-users mailing list