Digit Grouping (Adding Commas to Numbers)

So I just noticed that the numbers for XP don't have a comma when it exceeds 3 digits. Screenshot:

No Digits.png


Notice the "12538" to the right of "to next level". How would I go about fixing this? The comma shows up fine in the status menu (where all the info is more detailed). I'm using Galv_BustMenu, but as far as I can tell, it merely moves existing elements around instead of drawing its own custom stuff.
Which plugin is drawing the exp values there in the first place if not that one?
Upon further inspection, you're right Galv_BustMenu is drawing the exp values. I assumed it didn't since every other element was drawn by the MV js files.
JavaScript:
Window_MenuStatus.prototype.drawActorEXP = function(actor, x, y, width) {
    if (Galv.BM.xpBar) {
        var color1 = this.xpGaugeColor1();
        var color2 = this.xpGaugeColor2();
        if (actor.isMaxLevel()) {
            var xprate = 0;
        } else {
            var xprate = actor.xpRate();
        };
        this.drawExpGauge(x, y, width, xprate, color1, color2);
    };
    if (Galv.BM.xpText) {
        this.changeTextColor(this.systemColor());
        this.contents.fontSize -= 6;
        this.drawText(xprate > 0 ? Galv.BM.xpLabel : Galv.BM.maxTxt, x, y + 4, 150);
        this.changeTextColor(this.normalColor());
        if (xprate > 0) this.drawText(actor.nextRequiredExp(), x - 1, y + 4, width, "right");
        this.contents.fontSize += 6;
    };
};
And this is what I've found in YEP_CoreEngine.js
JavaScript:
Yanfly.Util.toGroup = function(inVal) {
  if (typeof inVal === 'string') return inVal;
  if (!Yanfly.Param.DigitGroup) return inVal;
  return inVal.toLocaleString('en');
  return inVal.replace(/(^|[^\w.])(\d{4,})/g, function($0, $1, $2) {
    return $1 + $2.replace(/\d(?=(?:\d\d\d)+(?!\d))/g, "$&,");
  });
};

} else {

Yanfly.Util.toGroup = function(inVal) {
  if (typeof inVal !== 'string') { inVal = String(inVal); }
  if (!Yanfly.Param.DigitGroup) return inVal;
  return inVal.toLocaleString('en');
  return inVal.replace(/(^|[^\w.])(\d{4,})/g, function($0, $1, $2) {
    return $1 + $2.replace(/\d(?=(?:\d\d\d)+(?!\d))/g, "$&,");
  });
};
@Trihan So how would I add commas to 3+ digit numbers?

Edit: Omg, I can't believe I figured it out! Feels good learning everyday lol. I simply did this:
JavaScript:
        var xpNeeded = Yanfly.Util.toGroup(actor.nextRequiredExp());
        if (xprate > 0) this.drawText(xpNeeded, x - 1, y + 4, width, "right");
Yay! See, you can be your own helper. 🙂

Original thread: https://forums.rpgmakerweb.com/threads/digit-grouping-adding-commas-to-numbers.123995/