focus expression text field at startup -> version 1.2
[LeanCalc.git] / help / substr
1 NAME
2     substr - extract a substring of given string
3
4 SYNOPSIS
5     substr(str, pos, len)
6
7 TYPES
8     str         string
9     pos         nonnegative integer
10     len         nonnegative integer
11
12     return      string
13
14 DESCRIPTION
15     If pos > length of str or len is zero, the null string "" is returned.
16
17     If 1 <= pos <= strlen(str), substr(str, pos, len) returns the
18     string of length min(strlen(str) - pos + 1, len) formed by
19     consecutive characters of str starting at position pos, i.e. the
20     string has length len if this is possible, otherwise it ends with
21     the last character of str.  (The first character has pos = 1, the
22     second pos = 2, etc.)
23
24     If pos = 0, the result is the same as for pos = 1.
25
26 EXAMPLE
27     > A = "abcde";
28     > print substr(A,0,2), substr(A,1,2), substr(A,4,1), substr(A,3,5)
29     ab ab d cde
30
31 LIMITS
32     none
33
34 LINK LIBRARY
35     none
36
37 SEE ALSO
38     XXX - fill in
39