String.contains
String.contains
Function
Determine whether the string contains the specified fragment.
Syntax
string.contains(needle)
Parameters
| Parameters | Type | Required | Default value | Description |
|---|---|---|---|---|
| needle | Any | No | None | The fragment to be found will be converted into a string first when called. |
Return value
| Type | Description |
|---|---|
| Bool | Returns true if included, false otherwise. |
Example
text = 'hello BT' result = text.contains('BT') // 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.