splitString
lib.strings.splitString
Docs pulled from | This Revision | about 1 hour ago
Cut a string with a separator and produces a list of strings which were separated by this separator.
Inputs
sep
- 1. Function argument
s
- 2. Function argument
Type
splitString :: string -> string -> [string]
Examples
lib.strings.splitString
usage example
splitString "." "foo.bar.baz"
=> [ "foo" "bar" "baz" ]
splitString "/" "/usr/local/bin"
=> [ "" "usr" "local" "bin" ]
Noogle detected
Implementation
The following is the current implementation of this function.
splitString = sep: s:
let
splits = builtins.filter builtins.isString (builtins.split (escapeRegex (toString sep)) (toString s));
in
map (addContextFrom s) splits;