Re: Reversing a String
Re: Reversing a String
- Subject: Re: Reversing a String
- From: Douglas Davidson <email@hidden>
- Date: Mon, 5 Jan 2009 11:30:45 -0800
On Dec 31, 2008, at 8:52 AM, Michael Ash wrote:
The fundamental error that everyone is making here is in assuming that
a unichar is a single indivisible unit that can be tossed around at
will. But it doesn't work that way. Sometimes you have multiple
unichars next to each other in a grouping which must be preserved.
The old "reversing a string" problem has long since passed its prime,
and is overdue for retirement. It doesn't really have any practical
purpose, at least not as applied to real natural-language strings, and
it certainly isn't compatible with Unicode. Not only are there, as
you say, sequences of combining characters that need to be kept
together, but Unicode also has state-changing control characters; an
LRE/PDF pair, for example, needs to be kept in that order. There are
occasionally useful operations that involve character scrambling--
anagram generation, for example--but they really only make sense
within a limited character repertoire, so it would be necessary to
filter the input based on some appropriate character set.
Douglas Davidson
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden