Re: NSScanner Madness
Re: NSScanner Madness
- Subject: Re: NSScanner Madness
- From: "Angela Brett" <email@hidden>
- Date: Tue, 7 Dec 2004 22:35:20 +1300 (NZDT)
- Importance: High
Just a few suggestions...
> //generating my printText string which will hold the translation
> //and fall out of focus outside of this scope
> printText = [NSMutableString stringWithString:@""];
Why not simply [NSMutableString string]?
> //the C-style character that i'll translate
> char tempChar;
This should probably be a unichar, but...
> //reading one character out of the NSString-Style-string
> tempChar = [readText characterAtIndex:i];
> //converting that one character back into an NSString-Object
> tempString = [NSString stringWithCString:&tempChar length:1];
Instead of going through the bother of getting a character and then
converting that back into an NSString, it would be more convenient to use
tempString=[readText substringWithRange:NSMakeRange(i,1)];
I don't know if that makes a difference speed-wise, or if speed is even
important in your app, but it's simpler.
With the usual disclaimer about untested code... this code wasn't even
written in as good a code editor as Mail, but in a webmail form in IE on
OS 9 :/
Angela Brett
email@hidden
http://NSCoder.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden