Re: NSString, scramble
Re: NSString, scramble
- Subject: Re: NSString, scramble
- From: "Erik M. Buck" <email@hidden>
- Date: Sun, 1 Jul 2001 12:01:42 -0500
The direct equievelent of your Pacal code would use char arrays in C. The
fixed size strings and assumptions that all characters are one byte or at
least all the same length is similar to the assumvtions of C char arrays.
If you want to use NSString, keep in mind that you may encounter non-ASCII
encodings.
See NSRange, -characterAtIndex:, -rangeOfComposedCharacterSequenceAtIndex:
Here is an example of use:
unsigned int halfway;
NSRange midCharSequence;
halfway = [stringObj length] / 2;
midCharSequence = [stringObj
rangeOfComposedCharacterSequenceAtIndex:halfway];
halfway = midCharSequence.location;
You can use code like this to get any character sequence from a string.
Once you have a character sequence, you can append it to the result string
and delete it from the source string.