Simple ascii character search&replace ??
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] initWith
Data: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.