diff options
| author | joakin <joaquin@chimeces.com> | 2024-04-03 14:03:56 +0200 |
|---|---|---|
| committer | joakin <joaquin@chimeces.com> | 2024-04-19 13:35:53 +0200 |
| commit | 60ef4fda4dd71e5474bb2598c4e0d18c58924e99 (patch) | |
| tree | 1c9e603ad15a67d236a1ae607b0f1f56edd50159 /src/string.cpp | |
| parent | 1b143b9fa3d0302cda639abf72c7b5db1b7c1c41 (diff) | |
Recognize dynamic library names like libraylib.so.5.0.0
Diffstat (limited to 'src/string.cpp')
| -rw-r--r-- | src/string.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/string.cpp b/src/string.cpp index 3747f4564..a68cf315f 100644 --- a/src/string.cpp +++ b/src/string.cpp @@ -323,6 +323,25 @@ gb_internal bool string_contains_char(String const &s, u8 c) { return false; } +gb_internal bool string_contains_string(String const &haystack, String const &needle) { + if (needle.len == 0) return true; + if (needle.len > haystack.len) return false; + + for (isize i = 0; i <= haystack.len - needle.len; i++) { + bool found = true; + for (isize j = 0; j < needle.len; j++) { + if (haystack[i + j] != needle[j]) { + found = false; + break; + } + } + if (found) { + return true; + } + } + return false; +} + gb_internal String filename_from_path(String s) { isize i = string_extension_position(s); if (i >= 0) { |