- Home /
How to convert a string to int array in Unity C#
I have a comma separated string of numbers that I need to split into an array of integers. I tried this,
string s = "1,5,7";
int[] nums = Array.ConvertAll(s.Split(','), int.Parse);
but Visual Studio does not recognize the Array method.
Comment
Best Answer
Answer by MaxGuernseyIII · Jan 20, 2018 at 02:23 AM
It's in the System namespace, so you'll either need a using statement or you'll need to reference it as System.Array.
Your answer
Follow this Question
Related Questions
Converting a string to an int 2 Answers
Convert Array to String 3 Answers
Why Won't This Work? 1 Answer
Array - Convert Object into Int 5 Answers
Splitting String only on a "space". Using my method --- FIXED 2 Answers