Re: About NSString - uppercaseString
Re: About NSString - uppercaseString
- Subject: Re: About NSString - uppercaseString
- From: Ondra Cada <email@hidden>
- Date: Sat, 19 Oct 2002 15:06:35 +0200
On Saturday, October 19, 2002, at 01:09 , Webb wrote:
I think I must call NSString method "canBeConvertedToEncoding" before
calling "uppercaseString", such as:
No you don't have to.
NSString* aString = [NSString stringWithContentsOfFile:@"/Users/Webb/test.
dat"];
NSString* aConvertedString = nil;
if ( [aString canBeConvertedToEncoding:NSASCIIStringEncoding] ) {
aConvertedString = [aString uppercaseString];
} else {
aConvertedString = @"";
}
...
For some reasons the data of string may come from a image file. If I call
"uppercaseString" directly without calling "canBeConvertedToEncoding", I
will meet an error like this:
*** malloc[2283]: error for object 0x14ca220: Incorrect check sum for
freed object - object was probably modified after beeing freed; break at
szone_error
The best bet is you don't retain the string correctly. @"", being a
constant, does not ever free.
---
Ondra Cada
OCSoftware: email@hidden
http://www.ocs.cz
private email@hidden
http://www.ocs.cz/oc
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.