Logo

Programming-Idioms

History of Idiom 96 > diff from v32 to v33

Edit summary for version 33 by tamarit:
[Erlang] string:str/2 is obsolete

Version 32

2017-05-27, 19:49:42

Version 33

2017-07-21, 13:33:05

Idiom #96 Check string prefix

Set boolean b to true if string s starts with prefix prefix, false otherwise.

Illustration

Idiom #96 Check string prefix

Set boolean b to true if string s starts with prefix prefix, false otherwise.

Illustration
Code
B = string:str(S, Prefix) =:= 1.
Code
B = string:find(S, Prefix) =:= S.
Doc URL
http://erldocs.com/current/stdlib/string.html?i=0&search=string:st#str/2
Doc URL
http://erlang.org/doc/man/string.html#find-2
Demo URL
http://tryerl.seriyps.ru/#id=49f3
Demo URL
http://tryerl.seriyps.ru/#id=9bf3