Keywords - Function groups - @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Group: String Manipulation
See also: atof string

Function: substr
Description: substr extracts a substring from a string.

Usage: z = string (str, from, to)
Input:
str n x 1 string vector
from scalar or n x 1 vector, index of the first character extracted
to scalar or n x 1 vector, index of the first character following the extracted substring
Output:
z n x 1 string vector, extracted substring

Example:
fmt = "Number  : %10.3f"
i   = 1:10
str = string(fmt, i)
str = substr(str, i, i+10)
str

Result:
Contents of str

[ 1,] "Number  : "
[ 2,] "umber  :  "
[ 3,] "mber  :   "
[ 4,] "ber  :    "
[ 5,] "er  :     "
[ 6,] "r  :      "
[ 7,] "  :      7"
[ 8,] " :      8."
[ 9,] ":      9.0"
[10,] "     10.00"



(C) MD*TECH Method and Data Technologies, 05.02.2006