How to add thousand separator using regex?

Post your questions and help other users.

Moderator: Martin

Post Reply
gilanxcheetz
Posts: 18
Joined: 08 Nov 2018 15:10
Contact:

How to add thousand separator using regex?

Post by gilanxcheetz » 07 Jun 2019 05:50

anyone can help me, how to add a thousand separator with comma?
from 1234567 to 1,234,567
From: Redmi 5 Plus (Vince)

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: How to add thousand separator using regex?

Post by Desmanto » 07 Jun 2019 15:47

You don't need regex, a simple numberformat is enough.

Code: Select all

num = 1234567;
show = "{num,numberformat,#,###}";
For more about numberformat pattern, visit the documentation : https://automagic4android.com/automagic ... terns.html
Or you can find the numberformat help in the script help menu.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

gilanxcheetz
Posts: 18
Joined: 08 Nov 2018 15:10
Contact:

Re: How to add thousand separator using regex?

Post by gilanxcheetz » 07 Jun 2019 16:14

Desmanto wrote:
07 Jun 2019 15:47
You don't need regex, a simple numberformat is enough.

Code: Select all

num = 1234567;
show = "{num,numberformat,#,###}";
For more about numberformat pattern, visit the documentation : https://automagic4android.com/automagic ... terns.html
Or you can find the numberformat help in the script help menu.
working perfectly, terima kasih :mrgreen:
From: Redmi 5 Plus (Vince)

Post Reply