String.starts_with
String.starts_with
Function
Determine whether the string starts with the specified prefix.
Syntax
string.starts_with(prefix)
Parameters
| Parameters | Type | Required | Default value | Description |
|---|---|---|---|---|
| prefix | Any | No | None | The prefix to be matched will be converted to a string first when called. |
Return value
| Type | Description |
|---|---|
| Bool | Returns true if the match is successful, otherwise returns false. |
Example
text = 'hello BT' result = text.starts_with('hello') // Output: true print result
Notes
- Matching is case sensitive.
- Return false when no parameters are passed to avoid empty parameters being mismatched as empty strings.