mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-12-16 08:56:04 +01:00
TSJ and TSV parsing (#1962)
* Deserialization support for tsv files * Benchmarking * Apparently moving the setter out of the lambda fixed the setAccessible issue * Thread it * Use AllArgsConstructor instead of field reflection * Clean up AllArgsConstructor TSV deserialization * Refactor TsvUtils * Remove AllArgsConstructors from Excels * Set field accessible * [WIP] TSJ improvements * [WIP] More TSV stuff * [WIP] More TSV stuff * Working TSV parser (slow) * Load Excels in TSJ > JSON > TSV priority
This commit is contained in:
@@ -395,4 +395,22 @@ public final class Utils {
|
||||
public static <T> T drawRandomListElement(List<T> list) {
|
||||
return drawRandomListElement(list, null);
|
||||
}
|
||||
|
||||
/***
|
||||
* Splits a string by a character, into a list
|
||||
* @param input The string to split
|
||||
* @param separator The character to use as the split points
|
||||
* @return A list of all the substrings
|
||||
*/
|
||||
public static List<String> nonRegexSplit(String input, int separator) {
|
||||
var output = new ArrayList<String>();
|
||||
int start = 0;
|
||||
for (int next = input.indexOf(separator); next > 0; next = input.indexOf(separator, start)) {
|
||||
output.add(input.substring(start, next));
|
||||
start = next + 1;
|
||||
}
|
||||
if (start < input.length())
|
||||
output.add(input.substring(start));
|
||||
return output;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user