string.starts()

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

Overview

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

Syntax

string.starts( s, prefix )
s (required)

String. The string to be checked.

prefix (required)

String. A string indicating the prefix to check against.

Examples

print( string.starts( "Test123", "Test" ) )    --> true
print( string.starts( "Test123", "est" ) )     --> false
print( string.starts( "12345678", "1234" ) )   --> true
print( string.starts( "12345678", "01234" ) )  --> false