Format Rp

PHOTO EMBED

Wed Aug 24 2022 04:36:59 GMT+0000 (UTC)

Saved by @GodFather #html

function formatRp(number) {
    var number_string = parseInt(number).toString(),
        split = number_string.split(","),
        remainder = split[0].length % 3,
        amount = split[0].substr(0, remainder),
        thousand = split[0].substr(remainder).match(/\d{3}/gi);

    if (thousand) {
        separator = remainder ? "." : "";
        amount += separator + thousand.join(".");
    }

    amount = split[1] != undefined ? amount + "," + split[1] : amount;
    return "Rp" + amount;
}
content_copyCOPY