string.ends()

Type Function
Library string.*
Return value Boolean
Revision Release 2024.3703
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