The International Simutrans Forum

 

Author Topic: SimString update  (Read 3768 times)

0 Members and 1 Guest are viewing this topic.

Offline Max-Max

  • Coder/patcher
  • *
  • Posts: 670
    • MK Development
  • Languages: SV,EN
SimString update
« 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)...

Offline Ters

  • Coder/patcher
  • Devotee
  • *
  • Posts: 5691
  • Languages: EN, NO
Re: SimString update
« Reply #1 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.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 10636
  • Languages: De,EN,JP
Re: SimString update
« Reply #2 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).