user426795 user426795 - 1 month ago 10
Objective-C Question

How to reset a NSMutableString with a empty value?

NSMutableString *str = [[NSMutableString alloc] init];


Suppose str has right know a value "me".

And On click of a button I want that the value of str get reset. That is the string value become nil or empty.

now i am using this
[myword stringWithString: @""];
but not working.

Answer

Use setString with "" as parameter.

[myWord setString:@""];

And if you want to make it nil, then release it and then set it to nil.

[myWord release];
myWord = nil;