Description:
Get multiple substrings from a string to form a new string.
Syntax:
s.sbs(a:b,…)
Note:
The function gets multiple substrings from string s to form a new string.
Parameter:
s |
The source string from which substrings are to be obtained |
a |
The start position where substrings are obtained; it is the a-to-last when a<0; default is 1 |
b |
The end position where substrings end; it is the b-to-last when a<0; let be=s.len() when b>s.len() or b is absent; let b=a when :b is absent |
Return value:
String
Example:
|
A |
|
1 |
="abcdefgh".sbs(2:3) |
"bc" |
2 |
="abcdefgh".sbs(:3) |
"abc" |
3 |
="abcdefgh".sbs(3:) |
"cdefgh" |
4 |
="abcdefgh".sbs(3) |
"c" |
5 |
="abcdefgh".sbs(2:4,6:7) |
"bcdfg" |
6 |
="abcdefgh".sbs(-5:7) |
"defg" |
7 |
="abcdefgh".sbs(2:-3) |
"bcdef" |
8 |
="abcdefgh".sbs(3:10) |
"cdefgh" |