RosettaCodeData/Task/Substring/Common-Lisp/substring.lisp

13 lines
377 B
Common Lisp
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
(let ((string "0123456789")
(n 2)
(m 3)
(start #\5)
(substring "34"))
(list (subseq string n (+ n m))
(subseq string n)
(subseq string 0 (1- (length string)))
(let ((pos (position start string)))
(subseq string pos (+ pos m)))
(let ((pos (search substring string)))
(subseq string pos (+ pos m)))))