diff options
Diffstat (limited to 'src/string.cpp')
| -rw-r--r-- | src/string.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/string.cpp b/src/string.cpp index 6812c5c39..1d14c3987 100644 --- a/src/string.cpp +++ b/src/string.cpp @@ -207,6 +207,23 @@ gb_inline bool string_ends_with(String const &s, String const &suffix) { return substring(s, s.len-suffix.len, s.len) == suffix; } +gb_inline bool string_starts_with(String const &s, u8 prefix) { + if (1 > s.len) { + return false; + } + + return s[0] == prefix; +} + + +gb_inline bool string_ends_with(String const &s, u8 suffix) { + if (1 > s.len) { + return false; + } + + return s[s.len-1] == suffix; +} + gb_inline isize string_extension_position(String const &str) { isize dot_pos = -1; isize i = str.len; |