Logo

Programming-Idioms

History of Idiom 46 > diff from v37 to v38

Edit summary for version 38 by freecoder:
[Rust] Added indents

Version 37

2017-11-30, 21:19:57

Version 38

2018-12-17, 18:31:39

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
let t=s[..5].to_string();
Code
let t = s[..5].to_string();