string_char把ascii数值转换成字符

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,ý,{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,ý,{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,,ý,{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,,ý,{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,,ý,{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,,ý,{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,,ý,{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,,ý,{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,,转

 

 

你可能感兴趣的:(笔记,lua,数据结构,前端)