![]() | ![]() | ![]() | trimmed-substring | ![]() |
|
| &optional start end | [Function] |
Purpose
Extract and trim a substring from string.
Package :gbbopen-tools
Module :gbbopen-tools
Arguments and values
| character-bag | A sequence containing characters | |
| string | A string designator | |
| start | Starting index into string (default is 0)
| |
| end | Ending index into string (default is nil, meaning
end of string)
| |
| trimmed-substring | A string |
Returns
The extracted, trimmed string
Examples
> (trimmed-substring '(#\space #\tab) "xxx abc yyy" 3 12) "abc" > (trimmed-substring " " "xxx abc yyy" 3 12) "abc" > (trimmed-substring " " "xxx abc yyy" 3) "abc yyy" > (trimmed-substring " " "xxx abc yyy" 3 13) "abc y" > (trimmed-substring " " "xxx abc yyy" 2 12) "x abc" > (trimmed-substring " " " abc ") "abc" >
Note
The function
(string-trim character-bag (subseq string start end))but avoids allocating an intermediate substring.
The GBBopen Project
![]() | ![]() | ![]() | trimmed-substring | ![]() |