Experimenting with tabs

This commit is contained in:
Krzosa Karol
2024-07-28 14:30:24 +02:00
parent 0c2683afaa
commit de7f084633
9 changed files with 153 additions and 16 deletions

View File

@@ -108,3 +108,45 @@ bool Seek(String16 string, String16 find, int64_t *index_out = NULL, SeekFlag fl
return result;
}
String16 ChopLastSlash(String16 s) {
String16 result = s;
Seek(s, L"/", &result.len, SeekFlag_MatchFindLast);
return result;
}
String16 ChopLastPeriod(String16 s) {
String16 result = s;
Seek(s, L".", &result.len, SeekFlag_MatchFindLast);
return result;
}
String16 SkipToLastSlash(String16 s) {
int64_t pos;
String16 result = s;
if (Seek(s, L"/", &pos, SeekFlag_MatchFindLast)) {
result = Skip(result, pos + 1);
}
return result;
}
String16 SkipToLastPeriod(String16 s) {
int64_t pos;
String16 result = s;
if (Seek(s, L".", &pos, SeekFlag_MatchFindLast)) {
result = Skip(result, pos + 1);
}
return result;
}
String16 CutPrefix(String16 *string, int64_t len) {
String16 result = GetPrefix(*string, len);
*string = Skip(*string, len);
return result;
}
String16 CutPostfix(String16 *string, int64_t len) {
String16 result = GetPostfix(*string, len);
*string = Chop(*string, len);
return result;
}