欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

javascript中char解码为string(代码讲解)

程序员文章站 2023-11-09 12:24:04
javascript中char解码为string(代码讲解) /** * 将一个char转换成字符串 * @param {object} bytes */ funct...

javascript中char解码为string(代码讲解)

/**
* 将一个char转换成字符串
* @param {object} bytes
*/
function charstostring (_s){

    _s = _s.replace(/(^\s*)|(\s*$)/g, "");

    var _r = "";

    for(var i in _s){

        _r += string.fromcharcode(_s[i]);

    }

    return _r;

}