string.ends()

Type Function
Library string.*
Return value Boolean
Revision 2017.3060
Keywords string, ends
See also string.starts()

Overview

Returns a boolean true or false depending on whether a given string ends with the specified suffix characters.

Syntax

string.ends( s, suffix )
s (required)

String. The string to be checked.

suffix (required)

String. A string indicating the suffix to check against.

Examples

print( string.ends( "Test123", "123" ) )     --> true
print( string.ends( "Test123", "12" ) )      --> false
print( string.ends( "12345678", "5678" ) )   --> true
print( string.ends( "12345678", "56789" ) )  --> false