C.10. CUT()

(As of Asterisk 1.2.8, use a pipe ("|") character instead of commas as a parameter delimiter.)
Processes a string in a variable according to a specified delimiter (default: -) and returns the requested fields. The field may also be a range of fields (e.g. 2-4) or multiple fields and ranges, separated with "&", e.g. 2-4&6; ranges such as 3- (everything from field 3 on) or -3 (everything up to field 3) is possible.
If a comma is used as a delimiter, it must first be escaped with a backslash, e.g. CUT(var,\,,2).
exten => 123,1,Set(var=1-2-3-4-5)            ; var is "1-2-3-4-5"
exten => 123,n,Set(var=${CUT(var,,1-3&5)})   ; var is "1-2-3-5"


The parameter variablename must be the name of a variable, and not a string. If foo is the variable name and bar the contents, the following example would be incorrect: CUT(${bar},,3)


Internal help for this application in Asterisk 1.4:
  -= Info about function 'CUT' =- 


Slices and dices strings, based upon a named delimiter.

  varname    - variable you want cut
  char-delim - defaults to '-'
  range-spec - number of the field you want (1-based offset)
             may also be specified as a range (with -)
             or group of ranges and fields (with &)
diff output to internal help in Asterisk 1.2:
- none -