Re: print object by %@
Re: print object by %@
- Subject: Re: print object by %@
- From: Ariel Feinerman <email@hidden>
- Date: Thu, 22 Jul 2010 21:44:31 +0300
Stephen,
you are right, I wish to get a function can use printf style, prints
Objective-C objects clearly and efficiently by %@,
I do not understand, hm, why there is no such function (except NSLog()) in
Cocoa?
Charlie,
-desription message can return localized NSString, so using of utf16 is
necessity
2010/7/22 Stephen J. Butler <email@hidden>
> On Thu, Jul 22, 2010 at 12:57 PM, Ariel Feinerman <email@hidden>
> wrote:
> > Thank you for yours, but I am looking for more convenient way, I mean a
> > function for console output, not for debugging like NSLog(),
> >
> > so I wish:
> >
> > NSLog(@"object is %@", obj);
> > // $ object is [object description]
> >
> > I would not wish to convert NSString to utf8 for printf(), I wish to use
> > NSString
>
> If you REALLY want to avoid C stdio...
>
> I think the closest you'll get is [NSFileHandle
> fileHandleWithStandardOutput]. But even then, NSFileHandle writes
> NSData objects, not NSStrings. So you'll still need something like
> [myString dataUsingEncoding:NSUTF8StringEncoding]. Which is really
> what you want anyway since most people's terminals are setup to accept
> UTF-8.
>
--
best regards
Ariel
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden