conditions for identifying errors in line formatting are not met

By fixing your loop, it works, the main problem being with

i < charArr.length - 1 

when the dot is at the end

for(int i = 12; i < charArr.length && i < 76;i++)
{
    if(charArr[i] == '.' && (charArr[i-1] == ' ' || 
                            charArr[Math.min(charArr.length -1, i+1)] != ' '))
   {
        problemWithDot = true;
        break;
   }
}

note

charArr[i+1] != ' ' is likely to cause problem so check that i + 1 does not exceed the array length.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top