Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,46 @@
import extensions;
import extensions'routines;
import system'collections;
import system'routines;
import system'text;
extension op : String
{
tokenize(separator,escape)
{
auto buffer := new TextBuilder();
auto list := new ArrayList();
bool escaping := false;
self.forEach:(ch)
{
if (escaping)
{
buffer.write:ch;
escaping := false
}
else if (ch == escape)
{
escaping := true
}
else if (ch == separator)
{
list.append(buffer.Value);
buffer.clear()
}
else
{
buffer.write:ch
}
};
^ list
}
}
const string testcase = "one^|uno||three^^^^|four^^^|^cuatro|";
public program()
{
testcase.tokenize("|", "^").forEach:printingLn
}