I have an array of strings as I have shown below. I am iterating through the string array and printing the fourth char of each string element which is always 1.
What I've been trying to do is implement an if statement, so that if every fourth char of each element is 1 then to print something, but I am unsure how to access each of the elements that I am iterating through.
I have added an if statement with some pseudo code to try and highlight what I am trying to do. Thanks for your help.
namespace ConsoleApplication6
{
class Program
{
static void Main()
{
string[] bitstrings = new string[16];
bitstrings[0] = "00101";
bitstrings[1] = "00001";
bitstrings[2] = "00001";
bitstrings[3] = "00101";
bitstrings[4] = "00101";
bitstrings[5] = "00101";
bitstrings[6] = "00101";
bitstrings[7] = "00101";
bitstrings[8] = "00101";
bitstrings[9] = "00101";
bitstrings[10] = "00101";
bitstrings[11] = "00101";
bitstrings[12] = "00101";
bitstrings[13] = "00101";
bitstrings[14] = "00101";
bitstrings[15] = "00101";
for (int x = 0; x < bitstrings.Length; x++)
{
int s = bitstrings[x][4];
Console.ReadLine();
}
if(/*all bitstrings[x][4] = 1*/)
{
//print something
}
}
}
}