Money formatting?

BlitzMax Forums/BlitzMax Beginners Area/Money formatting?

Hi guys, I'm having a bit of trouble coming up with a function to format some text into money. Like this:

$45404 becomes $45,404
1050 becomes $1,050

Anyone got a function to do that lurking around?
Any help greatly appreciated.

read the string (or convert it to a string if it's a number), count 3 chars from the end and insert a comma? (repeat if wanted)

Here is something similar I did once.
Function numbify:String( value:Int )

	Local str:String
	str =  value

	Local num = 0
	Local tmp:String = ""
	
	For Local i = Len(str)-1 To 0 Step -1
		If num = 3 Then
			tmp = "'"+tmp
			num = 1
		Else
			num=num+1
		EndIf

		tmp = Chr(str[i])+tmp
	Next

	Return tmp
EndFunction


I can't seem to get my head around it. it's doin' me nut.

edit: Oops, thanks, dude. You the man. It was really getting on my nerves. Thanks very much both of you. How about adding this to the code arcs for other people to use.