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 |
fmt = "Number : %10.3f" i = 1:10 str = string(fmt, i) str = substr(str, i, i+10) str
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"