A few movie scripts which display the ascii values of a lingo string (hexadecimal or decimal). Good for looking at junk.
--From Cole Tierney"s Code Corner
--http://homepages.together.net/%7Etierney/cole/code/
-- A few handlers for examining the contents of a lingo string.
-- Good for looking at non-ascii chars
on putHex thisStr
put hex( thisStr )
end
on hex thisStr -- Returns the chars of "thisStr" as hex strings delimited by spaces
set outStr = ""
set strLength = length( thisStr )
repeat with i = 1 to strLength
put charToHexByteStr( char i of thisStr ) & " " after outStr
end repeat
return outStr
end
on putDec thisStr
put dec( thisStr )
end
on dec thisStr -- Returns the chars of "thisStr" as decimal strings delimited by spaces
set outStr = ""
set strLength = length( thisStr )
repeat with i = 1 to strLength
put charToNum( char i of thisStr ) & " " after outStr
end repeat
put outStr
return out
end
on charToHexByteStr theChar
set decimalValue = charToNum( theChar )
set nibble1 = nibNumToNibChar( integer( decimalValue / 16 ) )
set nibble2 = nibNumToNibChar( decimalValue mod 16 )
return nibble1 & nibble2
end
on nibNumToNibChar theNibble
case TRUE of
( theNibble < 10 ): return string( theNibble )
( theNibble < 16 ): return numToChar( theNibble + 55 )
otherwise alert "Nibble overflow." & theNibble
end case
end
Contact
MMI
36 South Court Sq
Suite 300
Newnan, GA 30263
USA