- Home /
Why Won't This Work?
I want to convert an int into a string then combine the first and last character together.
temp = seed.ToString();
temp2 = temp.Substring[0, 0] + temp.Substring[temp.length, 0];
For some reason I get this error: Internal compiler error: Array index is out of range..
For example if the "seed" variable was 12345, then "temp2" should be equal to 15.
Comment
Try "temp.length-1" as the second index. See if that fixes it.
Best Answer
Answer by Rod-Green · Nov 08, 2011 at 02:04 AM
You have the wrong bracket type for the substring method.. you need to use "(" & ")" not "[" & "]"
temp = seed.ToString();
temp2 = temp.Substring(0, 1) + temp.Substring(temp.length, 0);
Your answer
Follow this Question
Related Questions
Convert Array to String 3 Answers
How to convert a string to int array in Unity C# 1 Answer
Array - Convert Object into Int 5 Answers
Converting a string to an int 2 Answers