To those impressed by the conciseness of the solution using splits and joins, I recommend you go through this: http://stackoverflow.com/a/16776621
Hopefully, readers will stop citing that concise-impressive-but-wrong technique once and for all (as well as any code that operates on the same principle).
It’s actually quite alarming to see how that method has become so incredibly popular - perhaps because a lot of programmers have rather poor knowledge of character encoding, and haven’t been involved in the development of non-trivial multilingual applications, beyond the casual i18n/resource bundling grunt work - applications where things like collations, CJK handling, radical-stroke sorting etc. are common requirements.
There is also an absurd argument commonly presented in favor of this technique - that it is still a correct algorithm for a limited input set, which is equally disappointing to hear.