Garry's Mod Wiki

string.EndsWith

  boolean string.EndsWith( string str, string end )

Description

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

Arguments

1 string str
The string whose end is to be checked.
2 string end
The string to be matched with the end of the first.

Returns

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

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