diff options
| author | Jeroen van Rijn <Kelimion@users.noreply.github.com> | 2022-04-26 13:14:09 +0200 |
|---|---|---|
| committer | Jeroen van Rijn <Kelimion@users.noreply.github.com> | 2022-04-26 13:14:09 +0200 |
| commit | a5342a01267f55dec5a5b9f775cec8c8379139b1 (patch) | |
| tree | df6aec12051d2bb82790cf56ebe24147c54c2dd4 /src/string.cpp | |
| parent | 9f8d90f466454f4d14e755d44e4ba47ccbf0c92e (diff) | |
Address edge cases.
Diffstat (limited to 'src/string.cpp')
| -rw-r--r-- | src/string.cpp | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/src/string.cpp b/src/string.cpp index 3515df48e..616761265 100644 --- a/src/string.cpp +++ b/src/string.cpp @@ -298,41 +298,6 @@ String filename_from_path(String s) { return make_string(nullptr, 0); } -String remove_extension_from_path(String const &s) { - for (isize i = s.len-1; i >= 0; i--) { - if (s[i] == '.') { - return substring(s, 0, i); - } - } - return s; -} - -String remove_directory_from_path(String const &s) { - isize len = 0; - for (isize i = s.len-1; i >= 0; i--) { - if (s[i] == '/' || - s[i] == '\\') { - break; - } - len += 1; - } - return substring(s, s.len-len, s.len); -} - -String directory_from_path(String const &s) { - isize i = s.len-1; - for (; i >= 0; i--) { - if (s[i] == '/' || - s[i] == '\\') { - break; - } - } - if (i >= 0) { - return substring(s, 0, i); - } - return substring(s, 0, 0); -} - String concatenate_strings(gbAllocator a, String const &x, String const &y) { isize len = x.len+y.len; u8 *data = gb_alloc_array(a, u8, len+1); |