string.EndsWith

From Garry's Mod
Jump to: navigation, search
 string.EndsWith( )

Contents

Description

Returns whether or not the second passed string matches the end of the first.

Arguments

string str

The string whose end is to be checked.

Arguments

string end

The string to be matched with the end of the first.

Returns

boolean

true if the first string ends with the second, or the second is empty, otherwise false.

Examples

Example

Looks for arguments at the end of a string.

local endswith = string.EndsWith("Supercalifragilisticexpialidocious", "docious")
if endswith then
	print("Marry Poppins")
end

Output:

Marry Poppins
Personal tools
Navigation