开发者

NSlog() to NSString

开发者 https://www.devze.com 2023-03-06 21:58 出处:网络
I want to take an NSLog() message and save it as a NSString. For example, the following prints something l开发者_开发百科ike \"Player coordinates (0,0)\"

I want to take an NSLog() message and save it as a NSString.

For example, the following prints something l开发者_开发百科ike "Player coordinates (0,0)"

NSLog(@"Player cordinates(%i, %i)", xcord, ycord);

I want to save it's output (aka "Player coordinates (0,0)") into an NSString.


It can be done like that:

NSString *yourString = [NSString stringWithFormat:@"Player cordinates(%i, %i)", xcord, ycord];
0

精彩评论

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