I would like to know how to separate a string in C # unity, I ended up looking at some similar questions for C # and not on unity, I often found this example
string[] linha = reader.ReadLine().Split(new string[] { "||" }, StringSplitOptions.RemoveEmptyEntries);
and the error that the StringSplitOptions
function does not exist in context, then I would like to know a method.
Here's what I want to do, I'll have in a TXT file a line of text that I want to separate by the text for each || , Ex:
" Você acorda, o que faz?||Dormir mais||2||Levantar||1||Sentar e esperar||2||Cair da cama||3$2||1<> "
I want to separate this text as follows;
string lin1 = "Você acorda, o que faz?"
string lin2 = "Dormir mais"
string lin3 = "2"
string lin4 = "Levantar"
string lin5 = "1"
string lin6 = "Sentar e esperar"
string lin7 = "2"
string lin8 = "Cair da cama"
string lin9 = "3$2"
string lin10 = "1"
Note: < > in theory is to serve as line break;