query
On this page

stringToCharacters

lib.stringToCharacters

Docs pulled from | This Revision | 39 minutes ago


Convert a string to a list of characters (i.e. singleton strings). This allows you to, e.g., map a function over each character. However, note that this will likely be horribly inefficient; Nix is not a general purpose programming language. Complex string manipulations should, if appropriate, be done in a derivation. Also note that Nix treats strings as a list of bytes and thus doesn't handle unicode.

Inputs

s

1. Function argument

Type

stringToCharacters :: string -> [string]

Examples

stringToCharacters usage example

stringToCharacters ""
=> [ ]
stringToCharacters "abc"
=> [ "a" "b" "c" ]
stringToCharacters "🦄"
=> [ "�" "�" "�" "�" ]
(lib.strings.stringToCharacters)

Noogle also knows

Aliases