How i can split the json string in Unity? I have a string called entry_text, which is passed by a function. When I print it out. It is
"Atmosphere\t7\nGravity\t\nMagnetism\t\nSeismic Activity\t\nSurface\t\nTemperature\t\nWeather\t\nElement 1\t\nElement 2\t\nElement 3\t\n7",
which contains "\t", and "\n". So i want to split the string by "\t" and "\n".
I used the
string[] lines = entry_text.Split(new string[] {"\n"}, StringSplitOptions.None);
I also tried
string[] lines = Regex.Split(entry_text, "\n");
This also does not work:
string[] lines = entry_text.Split(new Char[] {'\n'}, StringSplitOptions.None);
It seems that the split function does not take "\n" as Enter or "\t" as space from Json.
\nnewline in it, or a` character followed by an` character? If the latter, have you tried\\ninstead of\n?