JanetDocsSourcePlaygroundTutorialsI'm Feeling luckyCommunityGitHub sign in

string/split

core-api


    cfunction
    src/core/string.c on line 449, column 1

    (string/split sep str &opt start limit)

    Splits a string `str` with separator `sep` and returns an array of 
    substrings. The substrings will not contain `sep`. If `sep` is not 
    found, the returned array will have one element. Will start 
    searching for `sep` at the index `start` (if provided), and return 
    up to a maximum of `limit` results (if provided).


3 examplesSign in to add an example
Loading...
(string/split "\n" @"works\nfor\nbuffers\ntoo")
# => @["works" "for" "buffers" "too"]
sogaiuPlayground
(defn slurp-lines [path]
  (string/split "\n" (slurp path)))
cellularmitosisPlayground
(string/split "," "bruce,scott,tiger,woods")
# => @["bruce" "scott" "tiger" "woods"]
sogaiuPlayground