Logo

Programming-Idioms

History of Idiom 46 > diff from v43 to v44

Edit summary for version 44 by programming-idioms.org:
[Elixir] Dead link: play.elixirbyexample.com has been down for a while

Version 43

2019-09-27, 23:12:58

Version 44

2019-10-14, 12:24:48

Idiom #46 Extract beginning of string (prefix)

Create string t consisting of the 5 first characters of string s.

Illustration

Idiom #46 Extract beginning of string (prefix)

Create string t consisting of the 5 first characters of string s.

Illustration
Code
t = String.slice(s, 0, 5)
Code
t = String.slice(s, 0, 5)
Doc URL
http://elixir-lang.org/docs/stable/elixir/String.html#slice/3
Doc URL
http://elixir-lang.org/docs/stable/elixir/String.html#slice/3
Demo URL
http://play.elixirbyexample.com/s/a6e74b4551