- Home /
string.Split('/') gets Incorect format error on run?
I have used this a bunch of times and am using it the same way in other places but I keep getting this error when I try to use it here "
System.FormatException: Input string was not in the correct format
at System.Int32.Parse (System.String s) [0x00010] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System/Int32.cs:629
" This is the code part
string loadedData = UnicodeEncoding.Unicode.GetString(SaveWorld.ReadFile(SaveWorld.saveFolder + "/worlds/" + SaveWorld.saveworld.worldName + "/" + playerName + ".txt"));
string copy = loadedData.ToString();
string[] splitData = copy.Split ("/"[0]);
List<slotInvDat> loadedSlots = new List<slotInvDat> ();
Debug.Log(loadedData);
This is what the loadedData string containes
"3/99/4/99/5/99/6/99/7/99/8/99/10/99/11/99/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/"
It looks like there's some code missing from your question. From the context I assume you're trying to convert the numbers between the slashes into integers. This is also evident from the exception that you're getting.
However you did not supply the code for that conversion. Please supply the code and the full stack trace so that we can help you.
I showed what the loaded data was returning and is encodes it as Unicode but its just a forloop that adds the int and then the "/"
Your answer
Follow this Question
Related Questions
Distribute terrain in zones 3 Answers
Multiple Cars not working 1 Answer
Score isn't adding when the combo timer runs out like it's suposed to, Whats wrong? 1 Answer
Enumerations in custom inspector C# 2 Answers
Sync with visual studio 2010 error 1 Answer