2
I wanted to know how to separate a string in Unity C#, I ended up looking at some similar questions for C# punch not in Unity, I often found this example
string[] linha = reader.ReadLine().Split(new string[] { "||" }, StringSplitOptions.RemoveEmptyEntries);
and the error that the function StringSplitOptions
does not exist in context, so I would like to know a method.
Here’s what I want to do, I will have in a TXT file a line of text that I want to separate by the texo for each || , Ex:
" Você acorda, o que faz?||Dormir mais||2||Levantar||1||Sentar e esperar||2||Cair da cama||3$2||1<> "
I would like 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: the <> in theory is to serve as line breaking;
Young man, did you manage to solve your problem? The answer answered what you needed or need something improved?
– Jéf Bueno