From 37e3e081c62b38bb4eff9553faadaea765f624b7 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Wed, 27 Nov 2019 15:18:32 +0000 Subject: Update microsoft_craziness.h to work correctly with the rest of the codebase (and not use WIN32_LEAN_AND_MEAN) --- src/string.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/string.cpp') 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; -- cgit v1.2.3