Logo

Programming-Idioms

History of Idiom 97 > diff from v20 to v21

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

Version 20

2016-09-27, 11:27:12

Version 21

2017-03-02, 05:44:55

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(-string.len(suffix)) == suffix
Comments bubble
Implementation for non static suffix