Subject: Convering a String Array to an Integer array
Posted By: nkrust Post Date: 1/12/2007 7:17:09 AM
Hi,
Is it possible to convert a string array which basically has no.'s to an integer array .. if so how ..?

------------------------------------------------------------------------------------------------------------
Adventure, Play, Alive, Fast, Race, Addict, React, Attack, Heat, Aggression, Blast, Ahead, Escape, Challenge, Anarchy, Game, Real, Damage, Insane, Acclerate,Passion, Fear, Dominate, Crazy, Awesome, Sweat, Habit, Avenge, Balls, Imagine, Viril, Chaos, Amuse, Heavy, Panic, @#!%, Fanatic
Reply By: nkrust Reply Date: 1/12/2007 8:06:12 AM

for(int i=0;i<arrLen;i++)
    str = arInfo[i];
    index = Convert.ToInt32(str);

I'm getting the following exception-
Exception Details: System.FormatException: Input string was not in a correct format.
The arInfo[] is basically an array of numbers

------------------------------------------------------------------------------------------------------------
Adventure, Play, Alive, Fast, Race, Addict, React, Attack, Heat, Aggression, Blast, Ahead, Escape, Challenge, Anarchy, Game, Real, Damage, Insane, Acclerate,Passion, Fear, Dominate, Crazy, Awesome, Sweat, Habit, Avenge, Balls, Imagine, Viril, Chaos, Amuse, Heavy, Panic, @#!%, Fanatic
Reply By: rohit.sharma Reply Date: 1/12/2007 4:52:59 PM
Please check this:

string[] arInfo = { "0", "1", "2", "3" };
int[] iarInfo = new int[4];
          for (int i = 0; i < arInfo.Length; i++)
          {
             iarInfo[i] = Convert.ToInt32(arInfo[i]);
             Console.Write(iarInfo[i]);
          }

i hope it will work for you.

Reply By: nkrust Reply Date: 1/12/2007 10:58:06 PM
I suppose that's the code that i used, and it doesn't work.

------------------------------------------------------------------------------------------------------------
Adventure, Play, Alive, Fast, Race, Addict, React, Attack, Heat, Aggression, Blast, Ahead, Escape, Challenge, Anarchy, Game, Real, Damage, Insane, Acclerate,Passion, Fear, Dominate, Crazy, Awesome, Sweat, Habit, Avenge, Balls, Imagine, Viril, Chaos, Amuse, Heavy, Panic, @#!%, Fanatic

Go to topic 54799

Return to index page 65
Return to index page 64
Return to index page 63
Return to index page 62
Return to index page 61
Return to index page 60
Return to index page 59
Return to index page 58
Return to index page 57
Return to index page 56