Search code examples
c++stringsorting

Alphabetically sorting strings


I need to make program that sorts strings in alphabet order. How can I do that?


Solution

  • Use std::sort (2nd version) and write a comparison function that compares characters alphabetically rather than lexicographically. If this has to deal with i18n/l10n then this function might be more difficult to write.