function stringTo16(_s:String="A"):void{
            var s1 = "";
            var rawdata:String = "";
            var handleresult:String;
            rawdata = _s;
            var byte:ByteArray=new ByteArray();
            byte.writeMultiByte(rawdata,"utf-8");
            for (var i:int; i<byte.length; i++)
            {
                var num:Number = parseInt(byte[i],10);
 
                handleresult +=  "%" + num.toString(16);
            }
            s1 = handleresult.substr(4,handleresult.length-4);
            
            trace(s1);
        }

输出的s1应该为41

posted on 2019-02-25 16:55  凌落成迷  阅读(339)  评论(0编辑  收藏  举报