3

I created an NSMutableString pointer variable and appended some text using the below code in the implementation file.

NSMutableString *displayString;
[displayString appendString: [NSString stringWithFormat:@"%i", digit]];

However, I would like to clear the displayString contents and would like append new text. Is there a way to do that?

nobody
  • 19,814
  • 17
  • 56
  • 77
TeKnofUNk
  • 531
  • 1
  • 7
  • 9

2 Answers2

7

Setting the string to an empty string should do the trick, and allow you to append to it again.

[displayString setString:@""]
nobody
  • 19,814
  • 17
  • 56
  • 77
0

You must set its string to empty string. In this case, it will be like

displayString.string = @""