Sunday, 8 September 2013

How to efficiently replace german umlauts in C++?

How to efficiently replace german umlauts in C++?

Assume that I get a few hundred lines of text as a string (C++) from an
API, and sprinkled into that data are german umlauts, such as ä or ö,
which need to be replaced with ae and oe. I'm familiar with encoding
(well, I've read http://www.joelonsoftware.com/articles/Unicode.html) and
solving the problem was trivial (basically, searching through the string,
removing the char and adding 2 others instead).
However, I do not know enough about C++ to do this fast. I've just
stumbled upon StringBuilder
(http://www.codeproject.com/Articles/647856/4350-Performance-Improvement-with-the-StringBuilde),
which improved speed a lot, but I was curious if there are any better or
smarter ways to do this?

No comments:

Post a Comment