• 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: Converting an HTML source string to a readable string
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Converting an HTML source string to a readable string


  • Subject: Re: Converting an HTML source string to a readable string
  • From: Eric Morand <email@hidden>
  • Date: Fri, 12 May 2006 11:26:16 +0200

Thanks Conor !!! It works perfectly !

I have not read what your method does yet (I just added it to my class) but the result is perfect ! :o)

Again, thanks, you made my day !



Eric.



Le 12 mai 06 à 11:09, Conor Dearden a écrit :

[self convertHTMLEncoding:MyString];

Add this function to your class:

- (NSString *)convertHTMLEncoding:(NSString *)aString {

    NSMutableString *tempMutableString = [NSMutableString
stringWithCapacity:150];
    [tempMutableString setString:aString];

while (YES) {
int tempInt = 0;
NSScanner *searchScanner = [NSScanner
scannerWithString:tempMutableString];
[searchScanner scanUpToString:@"&#" intoString:nil];
if ([searchScanner isAtEnd])
break;
[searchScanner setScanLocation:[searchScanner scanLocation] +2];
[searchScanner scanInt:&tempInt];



if (tempInt) {
if ([tempMutableString replaceOccurrencesOfString: [NSString
stringWithFormat:@"&#%d;", tempInt] withString:[NSString
stringWithFormat:@"%C", tempInt] options:NSLiteralSearch
range:NSMakeRange(0, [tempMutableString length])] == 0)
[tempMutableString
deleteCharactersInRange:NSMakeRange([searchScanner scanLocation] -2 ,2)];
}
else
[tempMutableString
deleteCharactersInRange:NSMakeRange([searchScanner scanLocation] -2 ,2)];
}
return tempMutableString;
}

_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Re: Converting an HTML source string to a readable string (From: Conor Dearden <email@hidden>)

  • Prev by Date: Re: Converting an HTML source string to a readable string
  • Next by Date: Implementing Quit
  • Previous by thread: Re: Converting an HTML source string to a readable string
  • Next by thread: connecting open-print-save-quit... to methods
  • Index(es):
    • Date
    • Thread