0

hello, i want to be able to split this string: "StraightPath1, 1, 2" into 3 sections: name, x, y. but when i use this code:

string[] pieces = line.Split(',')

it only i can only read the last 2 parts like this:

string Name = pieces[0]; //output: null
      int X = convert.ToInt32(pieces[1]); //output: 1
      int Y = convert.ToInt32(pieces[2]); //output: 2

I would like some help on advanced splitting string options
thank you.

2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by choover12
0

nevermind. it works. i don't know why it didn't work the first time?

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.