how do i transfer the contents of a string array to an int array in relation to my code below:
string[] sample= { "J♦", "3♦", "4♥", "Q♦", "9♥" };
convert(sample)
void sample(string[] straight)
int[] straight2 = new int[straight.Length];
for (int i = 0; i < straight.Length; i++)
{
if (straight[i].StartsWith("J"))
straight2[i] = int.Parse("11"); //works fine
}
for (int i = 0; i < straight.Length; i++)
{
if (straight[i].StartsWith("Q"))
straight2[i] = int.Parse("12"); //works fine
}
for (int i = 0; i < straight.Length; i++)
{
straight2[i]=int.Parse(straight[i].Substring(0,1)); // ERROR: INPUT STRING NOT IN CORRECT FORMAT
}
So i should have (11,3,4,12,9) //just the numbers. i don't want to include the suits (♦, ♥)
Please help