diff options
author | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2005-02-13 20:57:52 +0000 |
---|---|---|
committer | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2005-02-13 20:57:52 +0000 |
commit | 4ff9c9455bae3f64dc7d2a94f77554e9e8264601 (patch) | |
tree | 61b8c70671824b0e604f005ea6652201860bb2f6 /doc | |
parent | 2ca913e57c001464e93733481ca91a30e2bc0a3b (diff) |
Fix colon expansion (bug #3572)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@5023 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'doc')
-rwxr-xr-x | doc/README.variables | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/doc/README.variables b/doc/README.variables index e4c5d7d40..fb9e6f913 100755 --- a/doc/README.variables +++ b/doc/README.variables @@ -56,8 +56,8 @@ requires a variable), just write the name. To refer to the variable's value, enclose it inside ${}. For example, SetVar takes as the first argument (before the =) a variable name, so: -;exten => 1,2,SetVar(koko=lala) -;exten => 1,3,SetVar(${koko}=blabla) + exten => 1,2,SetVar(koko=lala) + exten => 1,3,SetVar(${koko}=blabla) stores to the variable "koko" the value "lala" and to variable "lala" the value "blabla". @@ -65,6 +65,32 @@ value "blabla". In fact, everything contained ${here} is just replaced with the value of the variable "here". +_______________________________ +REMOVING CHARACTERS FROM STRING +------------------------------- + +If you want to remove the first N characters from a string, you just +add a colon and the number of characters, like + + ;Remove the first character of extension, save in "number" variable + exten => _9X.,1,setvar(number=${EXTEN:1}) + +A second colon limits the number of characters used from the original +string. + ;Strip five characters from the start of string, use only two + ; (character 6 and 7 in the original string) + exten => 1000,4,setvar(skrep=${STRING:5:2}) + +You can also count from the end of the string by giving a negative +position: + + ;Use the two first of the three last characters in the account code + exten => 4500,4,setvar(acc=${ACCOUNTCODE:-3:2}) + +Or + ;Use the last three digits of the phone number + exten => 6112,4,goto(${EXTEN:-3},1) + ___________________________ EXPRESSIONS: --------------------------- |