开发者

NSLog without new line

Is there any function t开发者_运维技巧hat does what NSLog does but without the new line at the end?


see this http://borkware.com/quickies/one?topic=NSString

excerpted from that page:

void LogIt (NSString *format, ...)
{
    va_list args;
    va_start (args, format);
    NSString *string;
    string = [[NSString alloc] initWithFormat: format  arguments: args];
    va_end (args);
    printf ("%s\n", [string UTF8String]);
    [string release];
} // LogIt

just customize the printf to suit your needs


You can use printf(), but the time won't be displayed, and you won't be able to use the "%@" sequence for objects.

That said, you can implement your own logging function, using printf(), and adding support for objects. You will need to know how to deal with C variable arguments.


you can use some trick. use special unicode character like:u00a0

NSLog(@"\n\n\n\u00a0")

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜