string.byte(s [, i [, j]])
string.byte是用来把字符转换成ascii数字,s为目标字符串,i为索引开始位置(从1开始),j为索引结束位置
string.char(...)
string.char是把ascii数值转换成字符
?
--默认为第1个返回a的ascii值
local r = string.byte('abcdefg') --97
?
--从索引2(b)到索引4(d)也就是分别返回bcd的ascii值
local r1,r2,r3 = string.byte('abcdefg',2,4) --98,99,100
?
--返回98所对应的字符
local r = string.char(98) --a
?
--返回98,,99,100对应的字符并连在一起返回
local r = string.char(98,99,100) --abc
?
local str=""
local tbl={}
for i=0,1000 do
if i<=255 then
local r = string.char(i)
str=str.."{"..i..","..r.."},"
else
local r= string.char((i-i%256)/256)
str=str.."{"..i..","..r..","
local r= string.char(i%256)
str=str..r.."},"
end
--table.insert(tbl,{i,r})
if i%10==0 then
str=str.."\n"
end
?
end
print(str)
?
{33,!},{34,"},{35,#},{36,$},{37,%},{38,&},{39,'},{40,(},
{41,)},{42,*},{43,+},{44,,},{45,-},{46,.},{47,/},{48,0},{49,1},{50,2},
{51,3},{52,4},{53,5},{54,6},{55,7},{56,8},{57,9},{58,:},{59,;},{60,<},
{61,=},{62,>},{63,?},{64,@},{65,A},{66,B},{67,C},{68,D},{69,E},{70,F},
{71,G},{72,H},{73,I},{74,J},{75,K},{76,L},{77,M},{78,N},{79,O},{80,P},
{81,Q},{82,R},{83,S},{84,T},{85,U},{86,V},{87,W},{88,X},{89,Y},{90,Z},
{91,[},{92,\},{93,]},{94,^},{95,_},{96,`},{97,a},{98,b},{99,c},{100,d},
{101,e},{102,f},{103,g},{104,h},{105,i},{106,j},{107,k},{108,l},{109,m},{110,n},
{111,o},{112,p},{113,q},{114,r},{115,s},{116,t},{117,u},{118,v},{119,w},{120,x},
{121,y},{122,z},{123,{},{124,|},{125,}},{126,~},{127,},{128,?,{129,?,{130,?,
{131,y,{132,?,{133,?,{134,?,{135,?,{136,?,{137,?,{138,?,{139,?,{140,?,
{141,?,{142,ν,{143,?,{144,н,{145,?,{146,?,{147,?,{148,?,{149,?,{150,?,
{151,?,{152,?,{153,?,{154,?,{155,?,{156,?,{157,?,{158,?,{159,?,{160,?
{161,?{162,?{163,?{164,佬{165,彬{166,潬{167,罬{168,转{169,齬{170,?
{171,?{172,?{173,���{174,?{175,ャ{176,177,178,179,180,������{181,������182,������183,������184,���185,���186,���187,���188,���189,���190,���{191,���192,?,{193,?,{194,?,{195,y,{196,?,{197,?,{198,?,{199,?,{200,?,
{201,?,{202,?,{203,?,{204,?,{205,?,{206,ν,{207,?,{208,н,{209,?,{210,?,
{211,?,{212,?,{213,?,{214,?,{215,?,{216,?,{217,?,{218,?,{219,?,{220,?,
{221,?,{222,?,{223,?,{224,?{225,?{226,?{227,?{228,佬{229,彬{230,潬
{231,罬{232,转{233,齬{234,?{235,?{236,?{237,���{238,?{239,ャ{240,{241,242,243,244,������245,������246,������247,������248,���249,���250,���{251,���252,���253,���254,���255,?
?
{257,,},{258,,},{259,,},{260,,},
{261,,},{262,,},{263,,},{264,,},{265,, },{266,,
},{267,,},{268,,},{269,,
},{270,,},
{271,,},{272,,},{273,,},{274,,},{275,,},{276,,},{277,,},{278,,},{279,,},{280,,},
{281,,},{282,,},{283,,},{284,,},{285,,},{286,,},{287,,},{288,, },{289,,!},{290,,"},
{291,,#},{292,,$},{293,,%},{294,,&},{295,,'},{296,,(},{297,,)},{298,,*},{299,,+},{300,,,},
{301,,-},{302,,.},{303,,/},{304,,0},{305,,1},{306,,2},{307,,3},{308,,4},{309,,5},{310,,6},
{311,,7},{312,,8},{313,,9},{314,,:},{315,,;},{316,,<},{317,,=},{318,,>},{319,,?},{320,,@},
{321,,A},{322,,B},{323,,C},{324,,D},{325,,E},{326,,F},{327,,G},{328,,H},{329,,I},{330,,J},
{331,,K},{332,,L},{333,,M},{334,,N},{335,,O},{336,,P},{337,,Q},{338,,R},{339,,S},{340,,T},
{341,,U},{342,,V},{343,,W},{344,,X},{345,,Y},{346,,Z},{347,,[},{348,,\},{349,,]},{350,,^},
{351,,_},{352,,`},{353,,a},{354,,b},{355,,c},{356,,d},{357,,e},{358,,f},{359,,g},{360,,h},
{361,,i},{362,,j},{363,,k},{364,,l},{365,,m},{366,,n},{367,,o},{368,,p},{369,,q},{370,,r},
{371,,s},{372,,t},{373,,u},{374,,v},{375,,w},{376,,x},{377,,y},{378,,z},{379,,{},{380,,|},
{381,,}},{382,,~},{383,,},{384,,?,{385,,?,{386,,?,{387,,y,{388,,?,{389,,?,{390,,?,
{391,,?,{392,,?,{393,,?,{394,,?,{395,,?,{396,,?,{397,,?,{398,,ν,{399,,?,{400,,н,
{401,,?,{402,,?,{403,,?,{404,,?,{405,,?,{406,,?,{407,,?,{408,,?,{409,,?,{410,,?,
{411,,?,{412,,?,{413,,?,{414,,?,{415,,?,{416,,?{417,,?{418,,?{419,,?{420,,佬
{421,,彬{422,,潬{423,,罬{424,,转{425,,齬{426,,?{427,,?{428,,?{429,,�{430,,?
{431,,ャ{432,,433,,434,,435,,436,,��437,,��438,,��439,,��440,,�{441,,�442,,�443,,�444,,�445,,�446,,�447,,�448,,?,{449,,?,{450,,?,
{451,,y,{452,,?,{453,,?,{454,,?,{455,,?,{456,,?,{457,,?,{458,,?,{459,,?,{460,,?,
{461,,?,{462,,ν,{463,,?,{464,,н,{465,,?,{466,,?,{467,,?,{468,,?,{469,,?,{470,,?,
{471,,?,{472,,?,{473,,?,{474,,?,{475,,?,{476,,?,{477,,?,{478,,?,{479,,?,{480,,?
{481,,?{482,,?{483,,?{484,,佬{485,,彬{486,,潬{487,,罬{488,,转{489,,齬{490,,?
{491,,?{492,,?{493,,�{494,,?{495,,ャ{496,,497,,498,,499,,500,,��{501,,��502,,��503,,��504,,�505,,�506,,�507,,�508,,�509,,�510,,�{511,,�512,,
?
{513,,},{514,,},{515,,},{516,,},{517,,},{518,,},{519,,},{520,,},
{521,, },{522,,
},{523,,},{524,,},{525,,
},{526,,},{527,,},{528,,},{529,,},{530,,},
{531,,},{532,,},{533,,},{534,,},{535,,},{536,,},{537,,},{538,,},{539,,},{540,,},
{541,,},{542,,},{543,,},{544,, },{545,,!},{546,,"},{547,,#},{548,,$},{549,,%},{550,,&},
{551,,'},{552,,(},{553,,)},{554,,*},{555,,+},{556,,,},{557,,-},{558,,.},{559,,/},{560,,0},
{561,,1},{562,,2},{563,,3},{564,,4},{565,,5},{566,,6},{567,,7},{568,,8},{569,,9},{570,,:},
{571,,;},{572,,<},{573,,=},{574,,>},{575,,?},{576,,@},{577,,A},{578,,B},{579,,C},{580,,D},
{581,,E},{582,,F},{583,,G},{584,,H},{585,,I},{586,,J},{587,,K},{588,,L},{589,,M},{590,,N},
{591,,O},{592,,P},{593,,Q},{594,,R},{595,,S},{596,,T},{597,,U},{598,,V},{599,,W},{600,,X},
{601,,Y},{602,,Z},{603,,[},{604,,\},{605,,]},{606,,^},{607,,_},{608,,`},{609,,a},{610,,b},
{611,,c},{612,,d},{613,,e},{614,,f},{615,,g},{616,,h},{617,,i},{618,,j},{619,,k},{620,,l},
{621,,m},{622,,n},{623,,o},{624,,p},{625,,q},{626,,r},{627,,s},{628,,t},{629,,u},{630,,v},
{631,,w},{632,,x},{633,,y},{634,,z},{635,,{},{636,,|},{637,,}},{638,,~},{639,,},{640,,?,
{641,,?,{642,,?,{643,,y,{644,,?,{645,,?,{646,,?,{647,,?,{648,,?,{649,,?,{650,,?,
{651,,?,{652,,?,{653,,?,{654,,ν,{655,,?,{656,,н,{657,,?,{658,,?,{659,,?,{660,,?,
{661,,?,{662,,?,{663,,?,{664,,?,{665,,?,{666,,?,{667,,?,{668,,?,{669,,?,{670,,?,
{671,,?,{672,,?{673,,?{674,,?{675,,?{676,,佬{677,,彬{678,,潬{679,,罬{680,,转
{681,,齬{682,,?{683,,?{684,,?{685,,�{686,,?{687,,ャ{688,,689,,690,,{691,,692,,��693,,��694,,��695,,��696,,�697,,�698,,�699,,�700,,�{701,,�702,,�703,,�704,,?,{705,,?,{706,,?,{707,,y,{708,,?,{709,,?,{710,,?,
{711,,?,{712,,?,{713,,?,{714,,?,{715,,?,{716,,?,{717,,?,{718,,ν,{719,,?,{720,,н,
{721,,?,{722,,?,{723,,?,{724,,?,{725,,?,{726,,?,{727,,?,{728,,?,{729,,?,{730,,?,
{731,,?,{732,,?,{733,,?,{734,,?,{735,,?,{736,,?{737,,?{738,,?{739,,?{740,,佬
{741,,彬{742,,潬{743,,罬{744,,转{745,,齬{746,,?{747,,?{748,,?{749,,�{750,,?
{751,,ャ{752,,753,,754,,755,,756,,��757,,��758,,��759,,��760,,�{761,,�762,,�763,,�764,,�765,,�766,,�767,,�768,,
?
{769,,},{770,,},
{771,,},{772,,},{773,,},{774,,},{775,,},{776,,},{777,, },{778,,
},{779,,},{780,,},
{781,,
},{782,,},{783,,},{784,,},{785,,},{786,,},{787,,},{788,,},{789,,},{790,,},
{791,,},{792,,},{793,,},{794,,},{795,,},{796,,},{797,,},{798,,},{799,,},{800,, },
{801,,!},{802,,"},{803,,#},{804,,$},{805,,%},{806,,&},{807,,'},{808,,(},{809,,)},{810,,*},
{811,,+},{812,,,},{813,,-},{814,,.},{815,,/},{816,,0},{817,,1},{818,,2},{819,,3},{820,,4},
{821,,5},{822,,6},{823,,7},{824,,8},{825,,9},{826,,:},{827,,;},{828,,<},{829,,=},{830,,>},
{831,,?},{832,,@},{833,,A},{834,,B},{835,,C},{836,,D},{837,,E},{838,,F},{839,,G},{840,,H},
{841,,I},{842,,J},{843,,K},{844,,L},{845,,M},{846,,N},{847,,O},{848,,P},{849,,Q},{850,,R},
{851,,S},{852,,T},{853,,U},{854,,V},{855,,W},{856,,X},{857,,Y},{858,,Z},{859,,[},{860,,\},
{861,,]},{862,,^},{863,,_},{864,,`},{865,,a},{866,,b},{867,,c},{868,,d},{869,,e},{870,,f},
{871,,g},{872,,h},{873,,i},{874,,j},{875,,k},{876,,l},{877,,m},{878,,n},{879,,o},{880,,p},
{881,,q},{882,,r},{883,,s},{884,,t},{885,,u},{886,,v},{887,,w},{888,,x},{889,,y},{890,,z},
{891,,{},{892,,|},{893,,}},{894,,~},{895,,},{896,,?,{897,,?,{898,,?,{899,,y,{900,,?,
{901,,?,{902,,?,{903,,?,{904,,?,{905,,?,{906,,?,{907,,?,{908,,?,{909,,?,{910,,ν,
{911,,?,{912,,н,{913,,?,{914,,?,{915,,?,{916,,?,{917,,?,{918,,?,{919,,?,{920,,?,
{921,,?,{922,,?,{923,,?,{924,,?,{925,,?,{926,,?,{927,,?,{928,,?{929,,?{930,,?
{931,,?{932,,佬{933,,彬{934,,潬{935,,罬{936,,转{937,,齬{938,,?{939,,?{940,,?
{941,,�{942,,?{943,,ャ{944,,945,,946,,947,,948,,��949,,��950,,��{951,,��952,,�953,,�954,,�955,,�956,,�957,,�958,,�959,,�960,,?,
{961,,?,{962,,?,{963,,y,{964,,?,{965,,?,{966,,?,{967,,?,{968,,?,{969,,?,{970,,?,
{971,,?,{972,,?,{973,,?,{974,,ν,{975,,?,{976,,н,{977,,?,{978,,?,{979,,?,{980,,?,
{981,,?,{982,,?,{983,,?,{984,,?,{985,,?,{986,,?,{987,,?,{988,,?,{989,,?,{990,,?,
{991,,?,{992,,?{993,,?{994,,?{995,,?{996,,佬{997,,彬{998,,潬{999,,罬{1000,,转
?
?