INNER CODE UNIT · JavaScript
rgx
mdziekon/UniEngine · js/_libCommon.js:6
var rgx = /(\d+)(\d\d\d)/;
while (rgx.test(value)) {
value = value.replace(rgx, "$1" + "." + "$2");
}
return value;
};
// TODO: Also defined in common.js, deduplicate
const padStringLeft = (value, desiredLenght, padString) => {
const strValue = String(value);
const lengthLeft = desiredLenght - (strValue.length);
if (lengthLeft <= 0) {
return strValue;
}
const padding = (new Array(lengthLeft)).fill(padString, 0, lengthLeft).join("");
return `${padding}${strValue}`;