Check if a string ends with (string.ends_with)
Declaration
ok = string.ends_with(text, suffix[, len])
Parameters
- text
string. - suffix
string. - len
integer, optional. Length to consider for search. Default: length oftext
.
Returns
- ok
boolean.
Description
Check whether
text
ends withsuffix
.
Available in versions after 2025-03-13
Example
nLog(string.ends_with('Hello, XXTouch', 'XXTouch')) -- true
nLog(string.ends_with('Hello, XXTouch', 'ello', 5)) -- true
Note: Uses function outside of this chapter: nLog