Re: C++ Strings Handling
Re: C++ Strings Handling
- Subject: Re: C++ Strings Handling
- From: John Haager <email@hidden>
- Date: Fri, 24 May 2002 09:17:30 -0700
On Friday, May 24, 2002, at 01:16 AM, Nathan Zamecnik wrote:
If you are refering to just a string of characters then NSString and
NSMutable string should do the trick. But, if you are looking to
convert
the STL string class into an NSString then from what I know you would
have
to write your own class that takes a C++ string and returns a NSString.
Doesn't have to be a class. A short function would work just as well.
Basically, just take your C++ string and iterate through it taking each
char
member of the string and sending that char to a NSMutableString and then
returning that string. There may be a NSString method that does this
that I
don't know of though.
Actually, that would be pretty inefficient. I'm pretty sure C++ strings
have a method for obtaining a char * C string. This can then be fed
into NSString's stringWithCString method. Much faster, and no need for
the intermediate Mutable String.
On 5/24/02 2:48 AM, "Francois Reboursier" <email@hidden>
wrote:
Hello all
A friend of mine tries to port C++ apps to Mac OS X. He tells me
that he
can't find the librairies for handlings strings.
Are those librairies provided with the DevTools? If yes how to use
them?
If no is there a way to add them?
-> John Haager <-
_______________________________________________
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.