Hey everyone,
I am writing a program that reads in sentences from a text file, and then converts those sentences (a StringBuffer) to a
String. Then, I convert that String into a character array. Once I do that, I want to do the following...
Right now, the following code will insert a '^' at the MAXPOS (say, 25) position in the character array, IF that MAXPOS position is a blank space ' '. Each time MAXPOS is reached, the count will reset to 0 and will again search the array to MAXPOS...this happens until the end of the character array.
Here is what I cannot do, and was wondering if someone can help me...If the MAXPOS position is not a blank space, I want to insert a '^' to the nearest blank space BEFORE the MAXPOS occurs (So, the blank space before the current
word).
Does anyone have any ideas? I'd greatly appreciate it. I'm not restricted to using a character array - analyzing the String directly is fine, too.
Thanks!