Garry's Mod Wiki

string.StartsWith

  boolean string.StartsWith( string inputStr, string start )

Just Added

This was just added in the latest version (2023.01.25). It might only be available on the Dev Branch right now.

Description

Returns whether or not the first string starts with the second.

Arguments

1 string inputStr
String to check.
2 string start
String to check with.

Returns

1 boolean
Whether the first string starts with the second.

Example

Demonstrates the use of string.StartsWith

print(string.StartsWith("hello there", "hell"))
Output: true