Hundreds of features to explore
Games made in Construct
Your questions answered
Popular & trusted by schools and Universities world-wide
Construct 3 runs in the browser & works offline
Students do not need accounts with us
Free education resources to use in the classroom
World class complete documentation
Official and community submitted guides
Learn and share with other game developers
Upload and play games from the Construct community
Game development stories & opinions
Hello, I found topics for this problem but I have not been able to solve the problem.
I would like to replace this kind of display "123456" by 123 456 or 123,456 for example. When I ask a text to display a variable.
Excuse me for my bad English, I'm French.
Thank you for your help.
You can do this with regex:
Set v to 123456789
MyText set text to RegexReplace(str(v), "(?<=\d)(?=(\d\d\d)+(?!\d))", "g", ",")
I have difficulties to understand..
Regex is a plugin to download?
No, it's one of the system expressions.
Just copy and paste this into "TextObject Set Text" action:
RegexReplace(str(v), "(?<=\d)(?=(\d\d\d)+(?!\d))", "g", ",")
v is the variable with your big number.
Develop games in your browser. Powerful, performant & highly capable.
Thank you for your help, it works well when I run with Google Chrome but with NW.js an error appears, do you know why?
I don't know, I'm not a psychic :)
I have no issues running this code in NW.js
Try pressing F12 and check console log, maybe there will be some additional information about the error. If you can't figure it out, please post the error message and a screenshot of your events or capx file.