Cut( )
|
Assigns part of one variable to another
variable
|
Cut(newvar=varname,delimiter,fieldspec)
Cuts an existing variable named
varname into several pieces, and assigns one or
more of the pieces to a new variable named
newvar.
The delimiter argument is the
character on which to cut varname. It defaults to
-.
fieldspec is the number of the
field you want to assign to newvar. Fields are
counted starting with 1. The fieldspec may
be specified as a range (with -) or a group of ranges and
fields (with &). If more than one field is selected,
Cut( ) leaves the delimiter between the fields.
Returns 0, or -1 on hangup or
error.
exten => 123,1,Set(TEST=123-456-7890)
exten => 123,2,Cut(FIRST=TEST,-,2) ; gives us 456
exten => 123,3,Cut(SECOND=TEST,,1-2) ; gives us 123-456
exten => 123,4,Cut(THIRD=TEST,-,1&3) ; gives us 123-7890
|