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

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


  • Subject: Re: How to transform a NSString to a NSString C string format?
  • From: David Blanton <email@hidden>
  • Date: Thu, 5 Feb 2009 15:55:17 -0700

cStringUsingEncoding:

Returns a representation of the receiver as a C string using a given encoding.

- (const char *)cStringUsingEncoding:(NSStringEncoding)encoding


On Feb 5, 2009, at 3:52 PM, Iceberg-Dev wrote:

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:
40tularosa.net


This email sent to email@hidden



David Blanton





_______________________________________________

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: Luke the Hiesterman <email@hidden>
References: 
 >How to transform a NSString to a NSString C string format? (From: Iceberg-Dev <email@hidden>)

  • Prev by Date: Re: Transparency with PNG on NSImageView
  • Next by Date: Re: How to transform a NSString to a NSString C string format?
  • Previous by thread: How to transform a NSString to a NSString C string format?
  • Next by thread: Re: How to transform a NSString to a NSString C string format?
  • Index(es):
    • Date
    • Thread