• 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: Remove characters from string
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Remove characters from string


  • Subject: Re: Remove characters from string
  • From: "Heizer, Charles" <email@hidden>
  • Date: Thu, 17 Mar 2011 10:47:07 -0700
  • Acceptlanguage: en-US
  • Thread-topic: Remove characters from string

I really don¹t want to search though the entire string to find a replace.
The "©" is just an example of the characters I would like to remove. I
guess my real question is how do I remove all Unicode characters from a
string?

Thanks,
Charles






On 3/17/11 7:31 AM, "Conrad Shultz" <email@hidden> wrote:

>-----BEGIN PGP SIGNED MESSAGE-----
>Hash: SHA1
>
>On 3/17/11 7:03 AM, Heizer, Charles wrote:
>> Hello,
>> I would like to know how to remove certain characters from a NSString.
>>The
>> characters are "©". I thought I could just use encodings and convert
>>the
>> string using NSASCIIStringEncoding but that did not work and I'm not
>>sure
>> what the car codes are for these as well.
>
>Perhaps I am missing something, but since NSString handles Unicode fine,
>just use either NSString's
>stringByReplacingOccurrencesOfString:withString: or NSMutableString's
>replaceOccurrencesOfString:withString:options:range: ?
>
>This makes for less work and more readable code since you should be able
>to literally paste the "foreign" characters into your search string and
>not have to fuss around with character codes.
>
>Of course, if your input contains the problem characters in multiple
>underlying representations (say, from different languages), this
>complicates matters.  Such a situation happened to me a while back,
>wherein an application on the system and the terminal had different
>notions of how to store accented characters.  Suffice it to say this led
>to much hair pulling when it came time to do source code management
>("file X is been added, file X has been removed").
>
>
>
>- --
>Conrad Shultz
>
>Synthetiq Solutions
>www.synthetiqsolutions.com
>-----BEGIN PGP SIGNATURE-----
>Version: GnuPG/MacGPG2 v2.0.14 (Darwin)
>Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
>iEYEARECAAYFAk2CGzoACgkQaOlrz5+0JdWj4ACfd2ZCBIVmqGjFT29EmBE7tdaS
>D/cAnRsLDoDRD3r336J27udk6GTpCh/j
>=eAiC
>-----END PGP SIGNATURE-----

_______________________________________________

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: Remove characters from string
      • From: Dave Carrigan <email@hidden>
    • Re: Remove characters from string
      • From: Kyle Sluder <email@hidden>
    • Re: Remove characters from string
      • From: David Duncan <email@hidden>
References: 
 >Re: Remove characters from string (From: Conrad Shultz <email@hidden>)

  • Prev by Date: Sorting NSTableView + CoreData - odd behaviour
  • Next by Date: Re: Remove characters from string
  • Previous by thread: Re: Remove characters from string
  • Next by thread: Re: Remove characters from string
  • Index(es):
    • Date
    • Thread