That is a nice utility function. I imagine it can be useful to implement a text input field.

I did not test it, but looking at the code, I guess it is not working if the text has some transformation on it, like a 180° rotation for example, or even a maybe more realistic 90° rotation. I am not sure what would be the best way to support that knowing that `sf::Text::findCharacterPos` returns global coordinates.

Regarding time complexity, note that `sf::Text::findCharacterPos` has a linear complexity. Your current implementation, by making a linear amount of calls to it, has a quadratic complexity. That might not be noticeable on small enough strings, but using a binary search would probably be better.