Description
The endsWith
function checks whether the string haystack
ends with the substring needle
. It returns true
if this is the case, otherwise false
. If the optional parameter ignoreCase
is set to 1
, case sensitivity is ignored.
Note: Cannot be persisted using persist
.
Syntax
endsWith(haystack, needle[, ignoreCase])
Arguments
Argument | Description |
---|---|
haystack |
The string to be checked. |
needle |
The substring that is expected to be at the end of haystack . |
ignoreCase (optional) |
Indicates whether case sensitivity should be ignored. 1 means the check is case-insensitive, 0 or omitted means the check is case-sensitive. |
Return Types
The function returns a boolean value (true
or false
).
Examples
Description | Formula | Result |
---|---|---|
Checks case-sensitive if haystack ends with needle |
endsWith("Smenso Rocks", "Rocks") |
true |
Checks case-sensitive if haystack ends with needle |
endsWith("Smenso Rocks", "rocks") |
false |
Checks case-insensitive if haystack ends with needle |
endsWith("Smenso Rocks", "rocks", 1) |
true |
Notes
- Case sensitivity: By default, the function distinguishes between uppercase and lowercase letters.
- Optional parameters: The
ignoreCase
parameter can be used to disable this distinction.
Comments
0 comments
Please sign in to leave a comment.