Click here to Skip to main content
15,887,135 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to reinitialize (not appending )the mutable string to other value or string...?
Posted

C#
string firstString = "This is the initial string.";
firstString = firstString + "I am re-intializing it. It's being recreated based on how string addition work. It's not getting appeneded, instead new string created and then whole thing assigned to it!";


Read on String Vs StringBuilder. That should help.
 
Share this answer
 
NSMutableString *string = [[NSMutableString alloc] initWithString:@"Your first string"];

if (nil != string)
[string release], string = nil;

string = [[NSMutableString alloc] initWithString:@"Your second string"]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900