The International Simutrans Forum

Development => Patches & Projects => Topic started by: Max-Max on November 04, 2013, 01:14:35 AM

Title: SimString update
Post by: Max-Max on November 04, 2013, 01:14:35 AM
I moved my new std::string helper functions to simstring.

std::string trim(std::string)
std::string to_upper(std::string)
std::string to_lower(std::string)

These are used by the theme system (in a coming patch)...
Title: Re: SimString update
Post by: Ters on November 04, 2013, 06:05:24 AM
Just a warning: to_upper and to_lower are more complicated functions than one would believe. I've read that one has to think internationalization when using them.
Title: Re: SimString update
Post by: prissi on November 04, 2013, 11:18:54 AM
Better never ever use to_upper and to_lower on filesnames on on Unicode, if you ever hope that you code work on something else than DOS or windows. to?lower does very ugly stuff with umlaute too, i.e. may or may not ignore them. For the same reason I would not use trim, as there are spaces that are valid in file names (like the Kanji space for instance).