Added "strpos" function to regexroute.

git-svn-id: http://voip.null.ro/svn/yate@4456 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
paulc 2011-06-15 13:12:09 +00:00
parent 93402140eb
commit c18e7fae9a
2 changed files with 8 additions and 0 deletions

View File

@ -43,6 +43,7 @@
; $(ge,VAL1,VAL2) = "true" if VAL1 >= VAL2, "false" otherwise
; $(streq,VAL1,VAL2) = "true" if VAL1 = VAL2 (string), "false" otherwise
; $(strne,VAL1,VAL2) = "true" if VAL1 != VAL2 (string), "false" otherwise
; $(strpos,VAL1,VAL2) = 0-based position of VAL1 in VAL2, -1 if not found
; $(random,STRING) = STRING with each ? character replaced with a random digit
; $(index,N,ITEM1,ITEM2,...) = N-th (modulo length of list) item in list
; $(rotate,N,ITEM1,ITEM2,...) = list rotated N (modulo length of list) times

View File

@ -182,6 +182,13 @@ static void evalFunc(String& str)
ret ^= (str == par);
str = ret;
}
else if ((sep >= 0) && (str == "strpos")) {
str = par.substr(sep+1);
par = par.substr(0,sep);
vars(str);
vars(par);
str = str.find(par);
}
else if ((sep >= 0) && ((str == "add") || (str == "+")))
mathOper(str,par,sep,OPER_ADD);
else if ((sep >= 0) && ((str == "sub") || (str == "-")))