Logo

Programming-Idioms

History of Idiom 38 > diff from v46 to v47

Edit summary for version 47 by Dirk:
[Lisp] Fix and remove comments

Version 46

2019-09-26, 16:48:52

Version 47

2019-09-26, 16:49:58

Idiom #38 Extract a substring

Find substring t consisting in characters i (included) to j (excluded) of string s.
(character indexes start at 0 unless specified otherwise)

Illustration

Idiom #38 Extract a substring

Find substring t consisting in characters i (included) to j (excluded) of string s.
(character indexes start at 0 unless specified otherwise)

Illustration
Code
(subseq s i j)  ; Extract the part between i/j as described
(subseq s i)    ; Extract the part starting at i to the end of s
Code
(setf u (subseq s i j))
Comments bubble
t is not a good choice for a variable name in Lisp, so using s instead for the string
Comments bubble
t is not a good choice for a variable name in Lisp, so using u instead for the result string
Doc URL
http://www.lispworks.com/documentation/lw70/CLHS/Body/f_subseq.htm#subseq
Doc URL
http://www.lispworks.com/documentation/lw70/CLHS/Body/f_subseq.htm#subseq