RosettaCodeData/Task/Substring/Elixir/substring.elixir

6 lines
184 B
Plaintext

s = "abcdefgh"
String.slice(s, 2, 3) #=> "cde"
String.slice(s, 1..3) #=> "bcd"
String.slice(s, -3, 2) #=> "fg"
String.slice(s, 3..-1) #=> "defgh"