Hi
I have split text into an array using char[] and ToCharArray()
I want to do the below code using a loop instead of writing out each condition as an if statement. Would this be best as a loop or is it best to do each one individually? Also, if it is best to do as a loop, how??
if array[0] = "x" then do this.
if array[1] = "x" then do this
if array[2] = "x" then do this
if array[3] = "x" then do this
if array[4] = "x" then do this
My second question is how to join 3 arrays into a string. EG, if array 0,1,2 each represenst one letter it could spell the word egg (where 0=e 1 = e 2 = g). I would then need to say
if (group of arrays 0,1,2 = egg)
{
then do this
}
If any one can help, thank you
Dave
I have split text into an array using char[] and ToCharArray()
I want to do the below code using a loop instead of writing out each condition as an if statement. Would this be best as a loop or is it best to do each one individually? Also, if it is best to do as a loop, how??
if array[0] = "x" then do this.
if array[1] = "x" then do this
if array[2] = "x" then do this
if array[3] = "x" then do this
if array[4] = "x" then do this
My second question is how to join 3 arrays into a string. EG, if array 0,1,2 each represenst one letter it could spell the word egg (where 0=e 1 = e 2 = g). I would then need to say
if (group of arrays 0,1,2 = egg)
{
then do this
}
If any one can help, thank you
Dave
Comment