string_starts_with

This function checks if a string starts with the given substring. It returns true if it does, or false if it doesn't.

 

Syntax:

string_starts_with(str, substr);

ArgumentTypeDescription
strStringThe string to check for the occurrence of the given substring at the start
substrStringThe substring that the string should start with

 

Returns:

Boolean

 

Example:

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.