This function checks if a string starts with the given substring. It returns true if it does, or false if it doesn't.
string_starts_with(str, substr);
Argument | Type | Description |
---|---|---|
str | String | The string to check for the occurrence of the given substring at the start |
substr | String | The substring that the string should start with |
var _message = "Hello world";
if string_starts_with(_message, "Hello")
{
show_debug_message("Greeting successful!");
}
The above code first creates a string and stores it in a temporary variable _message. It then checks if the string starts with the string "Hello" and shows a debug message if that is the case.