Hi,
I’m trying to improve my logical thinking within loops by retrieving data and manipulating array elements.
The code that i’m working on is given below.
string s = "aaaaaaa. bbbbbbbb. cccccccc.";
char[] c = s.ToCharArray();
for (int i = 0; i < c.Length; i++ )
{
if (c[i] == '.') // (step 1) condition that catch a period punctuation.
{
i++// increment the index by one and move to the next element then let WHILE loop do the rest.
while (c[i]== ' ') //(step 2)
{
i++ //As long as while loop encountering an empty element it will be incremented by one
}
}
}
I have tried to solve this mystery for 2 days with different angels but with no luck. As you can see it’s a prototype and the code works perfectly according to my debugger. The main problem is when I declare a variable inside the while loop to get the targeted index that I want to upper case. In addition, I can’t retrieve a nested value outside as far as I know.
Anybody curious to solve this issue or giving thoughts about it.