• 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
Simple ascii character search&replace ??
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Simple ascii character search&replace ??


  • Subject: Simple ascii character search&replace ??
  • From: Yann Bizeul <email@hidden>
  • Date: Thu, 2 Jan 2003 15:12:31 +0100

Hi, and happy new year !

I'm just trying to modify an NSMutableString obtained by :
data = [[NSData alloc] initWithContentsOfURL:url];
encodedString =
[[[NSString alloc] initWithData:data
encoding:NSISOLatin1StringEncoding] autorelease];

Now I get a \\222 character inside this when I NSLog() the whole
string, that I want to replace by " ' " (quote).
But If I NSLog just the character ;
NSLog(@"%c", [ string characterAtIndex:9]);
I get this : \\355 (pretty weird)

An NSLog of the NSData representing the string confirms it is \\222
(octal)

For info : \\222 (ocal) == 146 (decimal) == 92 (hexadecimal)

To replace the character I do this :
[ string replaceOccurrencesOfString:[ NSString stringWithFormat:
@"%c", 146 ] withString:@"'" options:NSLiteralSearch
range:NSMakeRange(0, [string length]) ];

without success... any idea ?



--
Yann Bizeul
TYNSOE.ORG - http://www.tynsoe.org/
Site technique consacri ` MacOS X
_______________________________________________
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: straight-C DNS lookup with timeout?
  • Next by Date: Re: straight-C DNS lookup with timeout?
  • Previous by thread: Re: straight-C DNS lookup with timeout?
  • Next by thread: Re: Dynamic color changes in a text view
  • Index(es):
    • Date
    • Thread