$middle(), $substring()
DESCRIPTION
for a string, return a specified number of characters at the given index position
or:
for a string, return all characters to the end of the string starting at
the given index position
SYNOPSIS
$middle(s,i1,i2)
or:
$middle(s,i)
ARGUMENTS
s - a quoted string, or string expression
i1 - a positive integer, or integer expression
i2 - a positive integer, or integer expression
or:
s - a quoted string, or string expression
i - a positive integer, or integer expression
EXAMPLES
# pikt +C 'output $middle("earth",2,3)'
art
# pikt +C 'output $substring("string theory",8)'
theory
rule // strip any [ or ]
if $left($proc, 1) eq "["
set $proc = $mid($proc, 2)
=chomp($proc, "]")
fi
rule // set $gname, stripping off "+" or "-", if present
set $gname = $substr($group,#if(#nis,2,1))
rule // find $user and $newuser
set #i = #index($users, "-")
set $user = $substr($users,1,#i-1)
set $newuser = $substr($users,#i+1)
SEE ALSO
$chop()
$left()
$right()
$ltrim()
$rtrim()
$trim()
String Functions
Numerical Functions