• 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
How to transform a NSString to a NSString C string format?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to transform a NSString to a NSString C string format?


  • Subject: How to transform a NSString to a NSString C string format?
  • From: Iceberg-Dev <email@hidden>
  • Date: Thu, 5 Feb 2009 23:52:34 +0100

Problem:
--------

I would like to transform a NSString to a NSString conforming to the C string format.

Examples:
---------

toto -> toto

"toto -> \"toto

toto   -> toto\ntiti
titi


My Current Solution: --------------------

I can do this using a NSMutableString and a series of call to:

- replaceOccurrencesOfString:withString:options:range:

The problem I see with this solution is that I will probably forget some cases.

Question:
---------

Would there be a better solution? (I couldn't find a method in NSString, NSMutableString CFStringRef APIs but I might missed it).


_______________________________________________

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


  • Follow-Ups:
    • Re: How to transform a NSString to a NSString C string format?
      • From: "Stephen J. Butler" <email@hidden>
    • Re: How to transform a NSString to a NSString C string format?
      • From: Michael Ash <email@hidden>
    • Re: How to transform a NSString to a NSString C string format?
      • From: "Sean McBride" <email@hidden>
    • Re: How to transform a NSString to a NSString C string format?
      • From: David Blanton <email@hidden>
  • Prev by Date: Transparency with PNG on NSImageView
  • Next by Date: Re: Transparency with PNG on NSImageView
  • Previous by thread: Re: Transparency with PNG on NSImageView
  • Next by thread: Re: How to transform a NSString to a NSString C string format?
  • Index(es):
    • Date
    • Thread