LuaSearch
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user