URL Download
http://code.google.com/p/mwiphonesdk/source/browse/#svn/trunk/iMADE/PrepTasks/08
I have code at the location at the
As for having an NSMutableString*
and needing to return an NSString*
, the former is a subclass of the latter so anywhere you see an NSString*
an NSMutableString*
will suffice as-is.
Your code looks OK from what you've posted. The only thing I can think of is that perhaps there isn't any data to speak of when initializing the str
variable. In such a case appending an empty string will do nothing to mutableString.
You'll also want to make sure self.mutableString
has been properly allocated and initialized. You can send messages to NSObject*
s that are nil
which may be misleading when [self.mutableString length]
returns 0.
I have fixed the problem. I simply was not initializing the NSMutableString value and it was transparently not doing anything.
Before appending the string I put the following code.
if (_mutableString == nil){
_mutableString = [[NSMutableString alloc] init];
}
Thanks everyone for answering. And it is good to know that I can use NSMutableString in place of NSString. (that is too easy) :)