Re: How to remove accents from characters (i.e. ñ --> n)
Re: How to remove accents from characters (i.e. ñ --> n)
- Subject: Re: How to remove accents from characters (i.e. ñ --> n)
- From: Bergmann Manfred <email@hidden>
- Date: Thu, 22 Dec 2005 12:01:28 +1100
Hi there.
Nobody mentioned CFURLCreateStringByAddingPercentEscapes so far.
This encodes the accents (and other characters to percent escapes):
NSString *escape = (NSString *)CFURLCreateStringByAddingPercentEscapes
(NULL,
(CFStringRef)aString,
NULL,
CFSTR("'"),
kCFStringEncodingUTF8);
Best regards,
Manfred
Am 22.12.2005 um 06:49 schrieb John Fox:
Hello:
In order to generate usable Mapquest URLs, need a way to remove the
accent marks in an NSString, but keep the "base" character. For
example, if there is an ñ I need it converted to n, If there is an
ß I need it converted to ss.
Is there an easy way to do this? In the past, I've used an NSString
category which takes a dictionary where the key is the character
you want to replace, and the value is the replacement. The method
enumerate the keys in the dictionary and use
componentsSepratatedByString and then componentsJoinedByString to
do the replacement.
I'm wondering if there's a better and/or easier way.
Does anybody have any suggestions?
John
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40software-by-mabe.com
This email sent to email@hidden
--
software by MABE
http://www.software-by-mabe.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden