export default class Tool{ // only works for 8-bit chars static toByteArray(obj) { var uint = new Uint8Array(obj.length); for (var i = 0, l = obj.length; i < l; i++){ uint[i] = obj.charCodeAt(i); } return new Uint8Array(uint); } /** *//** * @函数功能: 10进制串转为BCD码 * @输入参数: 10进制串 * @输出结果: BCD码 */ static str2Bcd(asc) { let len = asc.length; let mod = len % 2; if (mod != 0) { asc = "0" + asc; len = asc.length; } let abt = [len]; if (len >= 2) { len = len / 2; } let bbt = [len]; for(let i=0; i<asc.length; i++){ abt[i] = asc.charCodeAt(i); } let j, k; for (let p = 0; p < asc.length/2; p++) { if ( (abt[2 * p] >= '0&
React Native中十进制字符串转为BCD码和BCD码转为十进制字符串
最新推荐文章于 2022-03-09 15:42:02 发布