Pilotscript - format a dollar amount to include commas?

In pilotscript, is there an elegant way to format a dollar amount to include commas? For example, if I have cost=18526, I can set cost := format('%.2f',cost) and then get 18526.00 but that's not quite what I want. Is there an easy way to get 18,526.00 instead?

Thanks,

John Feinberg