Logo

Programming-Idioms

History of Idiom 46 > diff from v46 to v47

Edit summary for version 47 by programming-idioms.org:
[Elixir] 404

Version 46

2019-12-04, 22:57:26

Version 47

2020-05-10, 21:35:56

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
Variables
t,s
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
https://hexdocs.pm/elixir/String.html#slice/3