Home > Community Toolbox Reference > String utilities
Checks whether the given string contains the substring or not. Always returns true for an empty substringg.
Argument | Type | Usage | Description |
---|---|---|---|
str | String |
Required | The string to find the substring in. |
substr | String |
Required | The string to check. |
Bool
The following example checks for an existence of a cuss word in the player name, and logs a message if one is found.
var _player_name = "Noname";
if (string_contains(_player_name, "cuss")) {
show_debug_message("Indecent name entered! Please select another one...");
}
- 24.6.0 - Created a function to check whether a given string contains the given substring.