Your code is kind of hard to follow, you should name your variables with meaningfull names (i and h in the first nested loop sure mean something more).
Also, it's not clear what algorithm you're using, it looks weird, the break instruction will finish the execution of that inner loop when the first letter is found in txtPtr. Are you sure you want to use "break" inside the loop instead of "continue"? With continue you skip the current iteration of the loop, but the loop will be executed again until it finishes.
Also note that a break in an inner loop won't break out of the outer loop (if that's what you intended).