Logo

Programming-Idioms

History of Idiom 97 > diff from v37 to v38

Edit summary for version 38 by chardan:
New Cpp implementation by user [chardan]

Version 37

2019-09-27, 12:53:47

Version 38

2019-09-28, 00:21:19

Idiom #97 Check string suffix

Set boolean b to true if string s ends with string suffix, false otherwise.

Illustration

Idiom #97 Check string suffix

Set boolean b to true if string s ends with string suffix, false otherwise.

Illustration
Extra Keywords
tail
Extra Keywords
tail
Code
return suffix.size() == s.size() - s.rfind(suffix);
Demo URL
https://godbolt.org/z/PjJek5