As the question says am trying to parse one of the elements of an string array into a int variable. although the code is right in terms of syntax, when I try to run it, I get the following error message.
Error 1 Building content threw FormatException: Input string was not in a correct format. at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) at System.Int32.Parse(String s) at TileContent.Tiles.TileLayerProcessor.Process(XmlDocument input, ContentProcessorContext context) in C:\Users\Darren\Documents\Enders\TileContent\Tiles\TileLayerProcessor.cs:line 75
here is the code that is causing the problem below
foreach (string line in lines)
{
string realLine = line.Trim();
if (string.IsNullOrEmpty(line))
continue;
string[] cells = realLine.Split(' ');
for (int x = 0; x < width; x++)
{
int cellIndex = int.Parse(cells[x]);
layer.Layout[row, x] = cellIndex;
}