码迷,mamicode.com
首页 > Web开发 > 详细

【转】JS字符(字母)与ASCII码转换方法

时间:2020-02-06 11:04:57      阅读:218      评论:0      收藏:0      [点我收藏+]

标签:min   arc   bsp   lower   转换   ons   class   i++   str   

var strVariable;
for(var i=0;i<25;i++)
{
    console.log(String.fromCharCode((65+i)));
}

strVariable.toUpperCase( ); //转大写
strVariable.toLowerCase( ); //转小写
//字符转ascii码:用charCodeAt();
//ascii码砖字符:用fromCharCode();
//大写字母A 到Z 的值是从65 到90;
//小写a到z 是从91 到 122;
//如:

  str="A";
  code = str.charCodeAt();//65
  str2 = String.fromCharCode(code);//A
  str3 = String.fromCharCode(0x60+26);//Z

 转自:https://www.cnblogs.com/mingrn/p/8064082.html

【转】JS字符(字母)与ASCII码转换方法

标签:min   arc   bsp   lower   转换   ons   class   i++   str   

原文地址:https://www.cnblogs.com/hycms/p/12267747.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!