char() operation now supports multiple values inside bracket. i.e. CHAR(45,120,49,45,81,45)

This commit is contained in:
windhamwong@nva-hk.com 2017-07-13 08:42:38 +01:00
parent 1e60054fe3
commit 93d47630b8

View file

@ -81,13 +81,16 @@ const ByteRepr = {
* @returns {byteArray} * @returns {byteArray}
*/ */
runFromCharHex: function(input, args) { runFromCharHex: function(input, args) {
var data = input.replace(/cha?r\((\d{1,3})\)/ig, var re = /cha?r\((((\d{1,3})(,\s?)?)+)\)/ig;
function(match, p1) { var inner_re = /(\d{1,3}),?/g;
if (p1) { var match, inner_match;
return Utils.byteArrayToChars([parseInt(p1)]); var result = "";
}; while ((match = re.exec(input)) != null) {
}); while ((inner_match = inner_re.exec(match[1])) != null) {
return data; result += Utils.byteArrayToChars([parseInt(inner_match[1])]);
}
}
return input.replace(re, result);
}, },