-
-
Notifications
You must be signed in to change notification settings - Fork 180
Open
Labels
enhancementTypically new features; lesser priority than bugsTypically new features; lesser priority than bugsrgbasmThis affects RGBASMThis affects RGBASM
Milestone
Description
Checking whether a string has a certain prefix or suffix is a common operation, which is why even high-level programming languages have added methods for it when they already had general-purpose substring-finding. (For example, C++ added .starts_with and .ends_with to std::string in C++20, and Javascript added .startsWith and .endsWith in ECMAScript 2015.)
I commented in #1884 that ^== and $== operators would make sense, in a parallel to regex ^ and $, or CSS ^= and $=. But even if it's not a common enough need to warrant operators, functions like STRSTARTS and STRENDS would also be useful.
Compare:
| Current | Functions | Operators |
|---|---|---|
STRFIND("\1", "prefix") == 0 |
STRSTARTS("\1", "prefix") |
"\1" ^== "prefix" |
STRRFIND("\1", "suffix") == STRLEN("\1") - STRLEN("suffix") |
STRENDS("\1", "suffix") |
"\1" $== "suffix" |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementTypically new features; lesser priority than bugsTypically new features; lesser priority than bugsrgbasmThis affects RGBASMThis affects RGBASM