The examples for cl-ppcre:split here
http://weitz.de/cl-ppcre/#split
include this tempting recipe:
(split "\s+" "foo bar baz frob")
=> ("foo" "bar" "baz" "frob")
However,
(split "\s+" " foo bar baz frob")
=> ("" "foo" "bar" "baz" "frob")
I.e., the result list includes an empty string as the first element if there are one or more whitespace characters at the beginning of the string.
How can I get rid of the empty string at the beginning? Is there a regexp match for this that would work with split?
Thanks,
Mark
Not with SPLIT, but how about this?
CL-USER 1 > (ppcre:all-matches-as-strings "\S+" " foo bar baz frob ") ("foo" "bar" "baz" "frob")
On Thu, Jul 2, 2015 at 9:16 PM, Mark H. David mhd@yv.org wrote:
The examples for cl-ppcre:split here
http://weitz.de/cl-ppcre/#split
include this tempting recipe:
(split "\s+" "foo bar baz frob")
=> ("foo" "bar" "baz" "frob")
However,
(split "\s+" " foo bar baz frob")
=> ("" "foo" "bar" "baz" "frob")
I.e., the result list includes an empty string as the first element if there are one or more whitespace characters at the beginning of the string.
How can I get rid of the empty string at the beginning? Is there a regexp match for this that would work with split?
Thanks,
Mark