Subj : Were i can get source cod To : Jasen Betts From : mark lewis Date : Mon Apr 01 2002 03:57 am JB> Hi mark. JB> 22-Mar-02 21:21:41, mark lewis wrote to John H. Guillory ml> witness the following (that i removed from a library ml> because of my belief that we should pass mail as ml> received and not modified [...] JB> so you don't claim ownership of this code, prolly a good thing :) hehehe, yeah, kinda... ml> Function CleanChar(InChar: Char): Char; ml> Const ml> CtlChars: String[32] = 'oooooooooXoollo><|!Pg*|^v><-^v'; ml> HiChars: String[64] = ml> 'CueaaaageeeiiiAAEaaooouuyOUcLYPfarounNao?--//!<>***|||||||||||||' ml> HiChars2: String[64]= ml> '|--|-+||||=+|=++-=--==-||||*****abcnEduto0nd80En=+> Begin ml> Case InChar of ml> #0..#31: CleanChar := CtlChars[Ord(InChar) + 1]; ml> #128..#191: CleanChar := HiChars[Ord(InChar) - 127]; ml> #192..#255: CleanChar := HiChars2[Ord(InChar) - 191]; ml> Else ml> CleanChar := InChar; ml> End; ml> End; JB> what a mess! to a point but it does work for the desired operation... that operation being to strip out certain characters and replace them with the ones in the constant strings/arrays... JB> most of the problem is using the wrong data type for the constants JB> - use array [char] of char i agree that maybe using the string structure was not efficient but i don't recall there being any real problem for the job that the code does... JB> someone well respected said that chosing the right data structures JB> can make the programming task much easier. JB> Function CleanChar(InChar: Char): Char; JB> Const JB> CtlChars: array[#0..#31] of char = ' JB> oooooooooXoollo><|!Pg*|^v><-=^v'; HiChars: array[#128..#255] JB> of char = JB> JB> 'CueaaaageeeiiiAAEaaooouuyOUcLYPfarounNao?--//!<>***|||||||||||||'+ JB> JB> '|--|-+||||=+|=++-=--==-||||*****abcnEduto0nd80En=+> Begin JB> Case InChar of JB> #0 ..#31: CleanChar := CtlChars[InChar]; JB> #128..#255: CleanChar := HiChars[InChar]; JB> Else CleanChar := InChar; JB> End; JB> End; JB> Not that that'll be any help except as an example. hey... it works and does speed up the operation... cycle counters would like it as there's no math functions to have to be done <> believe it or not, i've a similar operation in some REXX code that is/was used for "converting" ISO-8859-1 to PC850... problem is that when one is gathering web pages with wget, cleaning them and posting them to echos, one can't tell what character set is used unless there is something actually in the page data that states... i'm about to the point of either just replacing that routine with a 'null' routine or just altering the existing replacement table to be the 'normal' (standard?) US set... JB> P.S. I never saw any messages on this subject before yours. it was a year or so back... i had locked the message in my message base and forgotten to unlock it... saw it the other day and figured that it was better late than never... JB> did the originator find the source code they wanted? dunno... ;-( )\/(ark * Origin: (1:3634/12) .