Re: NSString or NSData
Re: NSString or NSData
- Subject: Re: NSString or NSData
- From: Eric Baur <email@hidden>
- Date: Thu, 22 Jul 2004 09:43:45 -0700
On Thu, 22 Jul 2004 11:35:37 -0500, Fritz Anderson
<email@hidden> wrote:
>
The down side of sticking to NSData is that you're thrown back to the
>
standard C library for things like searches.
>
Haven't done that for a long time... can you offer a pointer on where
to dig up more info on it? Or should I just drag out my old C
references?
>
For conversion from NSData to NSString: You have noticed NSString's
>
initWithData:encoding: method?
>
Oops. Saw it at one point, forgot about it for this project. :-)
>
Also, you should look at NSAttributedString and
>
NSMutableAttributedString. These are classes that do what you seem to
>
intend with strings -- add and manipulate colors and other attributes
>
-- and they can produce and be initialized from RTF. See
>
-[NSAttributedString RTFFromRange:documentAttributes:] for example. In
>
your place, I wouldn't bother with perfecting my own RTF generator,
>
when I had a library framework already in place to specify my string
>
and its colors, and get correct RTF for free.
>
I realized last night that I had forgotten about NSAttributedString -
I'm glad you mentioned it, I'll probably go back and try that route
instead. I was mainly just changing colors and, at a glance, it looks
to be pretty easy without me having to worry about control characters.
(In fact, most of the string manipulation had to do with managing
backslashes and such - but using an attributed string, I'm hoping I
can forget about that.)
Thanks,
Eric
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.