String.ends_with
String.ends_with
Function
Determine whether the string ends with the specified suffix.
Syntax
string.ends_with(suffix)
Parameters
| Parameters | Type | Required | Default value | Description |
|---|---|---|---|---|
| suffix | Any | No | None | The suffix 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
name = 'main.bt' result = name.ends_with('.bt') // Output: true print result
Notes
- Return false when no parameters are passed to avoid empty parameters being mismatched as empty strings.