String to list of single character strings - Computer Programming

Latest

C C++ Java Python Perl Programs Examples with Output -useful for Schools & College Students

Thursday, September 28, 2017

String to list of single character strings

Elixir calls each character a grapheme so we use the String.graphemes/1 method.

PROGRAM:

["T", "e", "s", "t"] = String.graphemes("Test")

# Contrast this with codepoints which may return
# multiple codepoints for a single character
["ö"]      = String.graphemes("ö")

["o", "̈"] = String.codepoints("ö")

No comments:

Post a Comment