Hi Troops,
All the seriousness around here has basically interferred with some of the fun we've had. Friday's especially were fun because it was the end of the week. From verse, to limericks, to puns, to simply being 0x626F6E656865616473, we had some jollies. Then there was this issue of profanity. What we could and couldn't say. Now I'm a pretty light hearted guy, plus I don't believe in censorship. I'm as fun loving the next person. In fact, some call me a 0x6372617A79206D6F74686572206675636B6572. However, I do understand that some folks don't like it and won't tolerate it. So in deference to them...
Now as you might have guessed by this time, the above is a hexidecimal representation of some real words. Are they profane? In one case yes, in the other no. Now, the code below will translate the above into the appropriate words. Now be forewarned, if you don't like profanity, don't use the code to translate it. That's your choice.
So the next time you want to call some one an 0x617373686F6C65, you can use this.:-)
Lastly, I'm sorry, but the above doesn't work with Unicode. It's in the public domain, however, so please feel free to make whatever modifications you like. Just don't come banging on my door if it doesn't work right.:-)
DEFINE CLASS HexWords AS CUSTOM
FUNCTION WordToHex
LPARAMETER tcWord
LOCAL lni, lnlast, lcresult, lcchar, lnchar
lcresult = ""
lnlast = LEN(tcWord)
FOR lni = 1 TO lnlast
lcchar = SUBSTR(tcWord, lni, 1)
lcresult = lcresult + RIGHT(TRANSFORM(ASC(lcchar), "@0"), 2)
NEXT
lcresult = "0x" + lcresult
RETURN lcresult
ENDFUNC
FUNCTION HexToWord
LPARAMETER tcHex
LOCAL lni, lnlast, lcresult, lcHex, lnchar
lcresult = ""
lcHex = SUBSTR(tcHex, 3)
lnlast = LEN(lcHex)
FOR lni = 1 TO lnlast STEP 2
lnchar = EVALUATE('0x' + SUBSTR(lcHex, lni, 2))
lcresult = lcresult + CHR(lnchar)
NEXT
RETURN lcresult
ENDFUNC
ENDDEFINE
I've gotta stop hanging around with Koziol.< bg >
George
Ubi caritas et amor, deus ibi est