A way to add digit grouping to displayed variables?

Is there a way to add digit grouping to variables displayed in text boxes?

For example making 1000000 display as 1,000,000.

I've found that I can make menu numbers display that way using Yanfly's Core Engine, but I'm at a loss how to make this happen in other areas.
JavaScript has a toLocaleString() method that adds comma grouping to numbers.

So you could do with event commands
Code:
Control Variables -> yourVariableWithANumber -> Script -> $gameVariables.value(thatVariablesId).toLocaleString()

Or if you're using a plugin that allows you to display evals in text, such as Yanfly's Message Eval Text, instead of using \V[34] to display the value of the variable you could do it directly: \evalText<<$gameVariables.value(34).toLocaleString()>>
That works perfectly! Thank you!

This is gonna take a while to edit in.

Original thread: https://forums.rpgmakerweb.com/threads/a-way-to-add-digit-grouping-to-displayed-variables.156070/