Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Foolish question about NSStrings



On 28/11/02 9:48 am, Marco Binder <email@hidden> wrote:
> Have you tried the first sugestion "use another accepted method and
> declare it static if you want"? There is a class method
>
> + (id)stringWithUTF8String:(const char *)bytes
>
> in NSString, which should do what you want.

I haven't *actually* tried that, but it certainly looks as though it would
work.

A minor snag with it is that I'd have to convert all my strings into UTF-8
sequences, which is a bit awkward and makes it hard to easily edit the
values in the source code. (No doubt I'd write a little tool to do this and
just paste the results in to the source code).

Since my strings are all quite short and I'm going to be using them to
construct longer strings (I'm converting values from some character
encodings not supported by Apple), I'll probably use arrays of unichars and
munge them into strings (+initWithCharacters:length:) when required.

> marco

Cheers,

Chris
_______________________________________________
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.

References: 
 >Re: Foolish question about NSStrings (From: Marco Binder <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.