"My debug is successful but it just doesn't work how I would like it too"

That's a contradictory statement. What doesn't work? Off the top of my head I see your loop checks the entire string, when it should stop in the middle.