LuaSearch

This commit is contained in:
Krzosa Karol
2024-08-09 16:56:37 +02:00
parent 8bf32a557b
commit d1e645b17e
5 changed files with 37 additions and 4 deletions

View File

@@ -262,3 +262,18 @@ Int ChopNumber(String16 *string) {
Int result = strtoll(num_string.data, NULL, 10) - 1;
return result;
}
String16 ChopWhitespace(String16 *string) {
String16 new_string = *string;
String16 whitespace = {string->data, 0};
for (int64_t i = 0; i < string->len; i += 1) {
if (IsWhitespace(string->data[i])) {
new_string = Skip(new_string, 1);
whitespace.len += 1;
} else {
break;
}
}
*string = new_string;
return whitespace;
}