str.charCodeAt()与String.fromCharCode()用法

    xiaoxiao2021-03-25  209

    str='123';

    str.charCodeAt(0)=48;

    str的值为0~9str.charCodeAt(i)的值为48~57

    str的值为a~zstr.charCodeAt(i)的值为97~122

    str的值为A~Zstr.charCodeAt(i)的值为65~90

    String.fromCharCode(48, 49)=01

    str.charCodeAt(0)将字符转为计算机编码

    String.fromCharCode(48,49)将编码转为字符

    转载请注明原文地址: https://ju.6miu.com/read-2809.html

    最新回复(0)