How to convert Javascript string to octet/character array? -
i know how convert normal javascript string array of octets/characters. classic c unsigned char array. using struct/jspack library , need extract/unpack values data coming in string.
thanks!
see string.charcodeat.
var str = 'abcdefghijklmnopqrstuvwxyz0123456789'; var result = []; for(var = 0, length = str.length; < length; i++) { var code = str.charcodeat(i); // since charcodeat returns between 0~65536, save every character 2-bytes result.push(code & 0xff00, code & 0xff); } alert(result);
Comments
Post a Comment