Re: How to transform a NSString to a NSString C string format?
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