The theory is fine, but try compiling it and running it to see what happens. After you do that, read on
It won't work because of a few minor points:
1). You don't define the data type for textValue.
You should say:
2). You are using the wrong variable when doing your comparisons.
--although they are traditional, this is a good reason not to use i and j. I myself would use "index" and "position" respectively
3). Style points (OK, it won't not work because of style, but while I'm here...). While legal to ignore "{" and "}" for single-line blocks, it is preferred to include them. Two reasons: it makes the code easier to read, and (more importantly) if you had to go back and add a statement to the block, you have to remember to put the curley braces in. If they're there in the first place, it makes it easier later on (I was burned several times on this one before I learned better

)
in addition, your } curley brace should line up with the leftmost "if"--again, makes it easier to read.