• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: C++ Strings Handling
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Follow-Ups:
    • Re: C++ Strings Handling
      • From: Rosyna <email@hidden>
References: 
 >Re: C++ Strings Handling (From: Nathan Zamecnik <email@hidden>)

  • Prev by Date: Re: receiving mouse events outside of my window
  • Next by Date: Build product size
  • Previous by thread: Re: C++ Strings Handling
  • Next by thread: Re: C++ Strings Handling
  • Index(es):
    • Date
    • Thread