Created
April 28, 2015 18:00
-
-
Save Linell/2c274cc11a13a5acf3d5 to your computer and use it in GitHub Desktop.
split a string up into given chunks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"Jose" | |
|> String.codepoints() | |
|> Enum.chunk(2) | |
|> Enum.map(&Enum.join(&1, "")) | |
# ["Jo", "se"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Although,
josevalim
noted that you should probably useString.graphemes