How to convert double to currency format

Client SDK (REST / Android / Objective-C / Swift / JS )


Application ID


hello team backendless,
iam use dopsource
how to convert double to currency format? Thanks

Hello @xiaomieya

please provide example values, what you’ve got and what you want to get at the end

Regards, Vlad

hello @vladimir-upirov thanks for your respone.

I have a data table with double data types. like this.

when api call on dropsource the result is 2000.0 I want to get is 2,000 .

dropsource does not support currency format. DropSource technical support recommends doing this from the server side. can you help me?

Thanks @vladimir-upirov

When you put comma to separate digits in a number, it technically becomes a string. So while 2000 is an Double, "2,000" is already a string. To do this, you’d need to write logic either in codeless or on the Dropsource side to format the value that way.

hello @mark-piller

can you give me an example of how to convert double to string using codeless? thanks

Hi Xia,

Unfortunately, I cannot, this would be something our professional services team can do. This would be rather straight-forward - convert the number to a string and put a comma every 3 characters.


try to create a Codeless Custom Function:

and as result you will have the following:

0 => "$ 0"
2000 => "$ 2,000"
12330 => "$ 12,330"
89033 => "$ 89,033"
780 => "$ 780"
78 => "$ 78"
123456789 => "$ 123,456,789"

Regards, Vlad


oops, just noticed, there is a bug, the first char comes twice and there is no the last char in the result, let me fix

I’ve updated screen with logic and results

thanks @vladimir-upirov and @mark-piller its work.

Hi @vladimir-upirov, since this post is kind of old. Is this function above still the fastest way to format an INT into currency today? Please advise.

Thank you.

Hi @vladimir-upirov , hope you are well. Did you get the chance to look at my previous question above? Thanks

Hello @KLoic

Sorry for the delay

I’m not sure about the speed but using RegExp it definitely looks simpler


You can try it out at the following link

Regards, Vlad

1 Like

Thank you @vladimir-upirov . I appreciate your help!

Hi @vladimir-upirov ,

Can you show me a RegExp codeless block for changing a string from 1000 to € 1.000,00?

@KLoic @Michel_Loriaux
Maybe there is even an easier way to solve this, but here is my solution with a Javascript Snippet in a Custom Function.

And here is the Javascript in the Custom Code:

It is just covering one currency format, but it should be easy to add other formats as well.
Please let me know if there is an easier way. I found the RegEx solution to complicated in a multi-currency environment.

1 Like