im new to the mirc scripting stuff. i need some help with separating a random value.

for example; after a calculation. var %money = { $calc(54 * 2154 ) }

%money = 116316

now the output of the $calc function should be separeted by a comma every 3 digits. starting from the back.

so it would look like this: $ 116,316 or if the output was larger $ 1,116,316

searched on the web but couldn't find a suitable awnser.