开发者

trying to add a reassignment to append the special newline character to a string in Obj C

开发者 https://www.devze.com 2023-02-15 09:35 出处:网络
I\'m new to C and need to solve what I\'m sure is a very simple problem.How do I add a reassignment to append for a newline in Objective C.The hint given was append @\"\\n\".I want my output to appear

I'm new to C and need to solve what I'm sure is a very simple problem. How do I add a reassignment to append for a newline in Objective C. The hint given was append @"\n". I want my output to appear on a new line. My code is below:

- (IBAction)displaySomeText: (id)sender

{

    WonderfulNumber *myWonderfulNumber = [WonderfulNumber wonderfulNu开发者_StackOverflow社区mberWithFloat:pi];

    NSString *stringToOutput = @"The value is: ";

    stringToOutput = [stringToOutput stringByAppendingString:[myWonderfulNumber storedNumberAsString]];

    [textView insertText:stringToOutput];

}

Please help


stringToOutput = [stringToOutput stringByAppendingFormat: @"\n%@",[myWonderfulNumber storedNumberAsString]];
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号