Functions to work on strings are defined under the
String module. In the next few recipes, we will be using some of these functions.
In this recipe, we will be focusing on how to split strings using
Start a new IEx session by typing
iex in your command line.
To demonstrate the use of the
split functions in the
String module, we will follow these steps:
iex(1)> my_string = "Elixir, testing 1,2,3! Testing!" "Elixir, testing 1,2,3! Testing!"
iex(2)> String.split(my_string) ["Elixir,", "testing", "1,2,3!", "Testing!"]
iex(3)> String.split(my_string, ...