Don't click here unless you want to be banned.

LSL Wiki : LibraryASCII

HomePage :: PageIndex :: RecentChanges :: RecentlyCommented :: UserSettings :: You are crawl836.us.archive.org
string ASCII = "             \n                   !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~";
integer ord(string chr)
{
    if(llStringLength(chr) != 1) return -1;
    if(chr == " ") return 32;
    return llSubStringIndex(ASCII, chr);
}
string chr(integer i)
{
    i %= 127;
    return llGetSubString(ASCII, i, i);
}
Comments [Hide comments/form]
What does it do?
-- DolusNaumova (2006-05-19 12:43:35)
return the ascii value of a character.

Really the functions on Unicode should be used instead.
-- BlindWanderer (2006-05-19 17:56:39)
[\] should also be [\\]
-- DirtyMcLean (2006-05-29 21:19:43)
Restored
if(len >= 0) return -1;
to its original (correct) form
-- DoneQuijote (2007-01-18 13:00:51)
good catch, since it should only accept lengths of 1, I changed it so it breaks when the length is not equal to 1;
-- BlindWanderer (2007-01-20 09:22:34)
I removed a space between the '\n' (CR) character and the '!' character. If you cut/paste the example into SL, the ASCII (int) value was offsetted by 1. Now it compiles correctly.
-- AlphonsJano (2007-06-06 02:11:16)
Attach a comment to this page: