Logo

Programming-Idioms

History of Idiom 97 > diff from v21 to v22

Edit summary for version 22 by Marolex:
New Lua implementation by user [Marolex]

Version 21

2017-03-02, 05:44:55

Version 22

2017-03-02, 05:46:01

Idiom #97 Check string suffix

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

Illustration

Idiom #97 Check string suffix

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

Illustration
Code
b = s:sub(-5) == suffix
Comments bubble
-5 is equal to the length of your non static suffix.