• 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: Clever way to replace in a NSString
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Clever way to replace in a NSString


  • Subject: Re: Clever way to replace in a NSString
  • From: Nick Zitzmann <email@hidden>
  • Date: Mon, 29 Mar 2004 07:33:18 -0700

On Mar 29, 2004, at 6:30 AM, Mathieu Godart wrote:

I'm wondering if there is an easy and efficient way to replace a specific
character by an other in a NSString (let's say I want to replace all spaces
by '+' char).

As Joar said, you can do this with NSMutableString. Please read the documentation: <http://developer.apple.com/documentation/Cocoa/Reference/Foundation/ ObjC_classic/Classes/NSMutableString.html>

The second funny thing I want to do with NSString is to relace all
characters with accents ('i', 'h', 'o', 'g', etc.) by their equivalent
without accent ('e, 'e', 'i', 'c', etc.). OK, I could do that manualy, but
those functions exist in PHP, for instance, and I cannot belive that Cocoa
doesn't have high level functions (or methods) to do that directly.

There is; use -lossyCString in NSString. That doesn't return an NSString, but you can use the result to make a new one...

One laste thing, is it possible to extract a substring matching a reg exp?

Not with Foundation, but there are three third-party frameworks that support regular expressions: AGRegex, MOKit, and OmniFoundation.

This is a rather frequently asked question, so I will now direct you to the archives: <http://cocoa.mamasam.com/>

Nick Zitzmann
<http://www.chronosnet.com/>
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


  • Follow-Ups:
    • Re: Clever way to replace in a NSString
      • From: "Mathieu Godart" <email@hidden>
References: 
 >Clever way to replace in a NSString (From: "Mathieu Godart" <email@hidden>)

  • Prev by Date: Re: Pre-Binding disabled when adding CURLHandle.framework
  • Next by Date: Re: Clever way to replace in a NSString
  • Previous by thread: Re: Clever way to replace in a NSString
  • Next by thread: Re: Clever way to replace in a NSString
  • Index(es):
    • Date
    • Thread