• 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: HTML-encoded characters mucking up my NSStrings
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: HTML-encoded characters mucking up my NSStrings


  • Subject: RE: HTML-encoded characters mucking up my NSStrings
  • From: email@hidden
  • Date: Wed, 11 Feb 2004 08:41:52 -0800

Hi Josh:

There is a general purpose way to do string substitution using a dictionary, NSString's componentsSeparatedByString and NSArray's componentsJoinedByString.

I can send you the code if you like but the way it works is very simple. You create a dictionary where each key is the escaped value (e.g. "&") and whose value is the unescaped string (in this case " ").

You enumerate each key in the dictionary (using keyEnumerator on NSDictionary). For each key in the enumeration call componentSeparatedByString using the key. This gives you an array. Using this array, you call componentsJoinedByString using the valueForKey in your dictionary of the current key in your enumeration.

Hope this helps,

John _______________________________________________
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.
  • Prev by Date: Re: None of an object's methods are being recognized.
  • Next by Date: Re: [Slightly OT] Shareware donation collection
  • Previous by thread: RE: HTML-encoded characters mucking up my NSStrings
  • Next by thread: XML-RPC and WebServices
  • Index(es):
    • Date
    • Thread