aboutsummaryrefslogtreecommitdiff
path: root/src/string.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2019-11-27 15:18:32 +0000
committergingerBill <bill@gingerbill.org>2019-11-27 15:18:32 +0000
commit37e3e081c62b38bb4eff9553faadaea765f624b7 (patch)
tree71d208a891ae1b379873e4db495de09958ffc281 /src/string.cpp
parent5ea9fc3fb0a0ea5201fe0f1006d40f03563191ca (diff)
Update microsoft_craziness.h to work correctly with the rest of the codebase (and not use WIN32_LEAN_AND_MEAN)
Diffstat (limited to 'src/string.cpp')
-rw-r--r--src/string.cpp17
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;