@genexus/web-standard-functions
Version:
GeneXus JavaScript standard functions library for web generators
23 lines • 577 B
JavaScript
import { padLeft } from "../text/padLeft";
/**
* Converts the given number to string
* @param {number} value
* @param {number} length
* @param {number} decimals
* @returns string
*/
export const str = (value, length = 10, decimals = 0) => {
let result = value.toFixed(decimals);
if (result.length > length) {
if (decimals === 0) {
return padLeft("", length, "*");
}
else {
return str(value, length, 0);
}
}
else {
return padLeft(result, length, " ");
}
};
//# sourceMappingURL=str.js.map