Numerical values: switching commas with dots!

Get help using Construct 2

Post » Tue Jan 21, 2014 3:50 am

Hi everyone,
I know this sounds like a newbie question but i dont think it is... i've been trying to replace commas with dots on textbox entered numerical values but i've been fruitless.

The problem is that the user might type 155,32 instead of 155.32 which is different for a calculation.

How can i fix this?

I know this is pretty much an algorithm issue but i've tried everything and i'm starting to lose hope...


Please help!
Thank you for your time!vila44802014-01-21 03:50:52
B
11
S
3
Posts: 51
Reputation: 1,251

Post » Tue Jan 21, 2014 2:47 pm

I have not tested this.. but according https://www.scirra.com/manual/126/system-expressions there is ready made function for replacements.

replace(src, find, rep)
Find all occurrences of find in src and replace them with rep.

One things that C2 direly needs is a lot more deeper user manual. The system expressions part is totally inadequate on explaining all the functions available. Especially those Regexp- commands ...
Need help? Upload .capx file with your question.
B
16
S
4
G
2
Posts: 233
Reputation: 2,560

Post » Tue Jan 21, 2014 4:22 pm

[QUOTE=Joannak][/QUOTE]
I must agree with you.
Thank you so much for your help and quick reply. I'll look into it and i'll post back my results.
B
11
S
3
Posts: 51
Reputation: 1,251

Post » Tue Jan 21, 2014 4:36 pm

Okay so...
Textbox -> Set text to replace(textbox.text, ",", ".")

WORKS!

Thank you so much Joannak!
You probably saved my job

PS: i never understood thats what this function is for from the manual reference.

SOLVED!
B
11
S
3
Posts: 51
Reputation: 1,251

Post » Tue Jan 21, 2014 7:01 pm

Well. I was not sure either, but it sounded like a right one to try.

Need help? Upload .capx file with your question.
B
16
S
4
G
2
Posts: 233
Reputation: 2,560


Return to How do I....?

Who is online

Users browsing this forum: koops, Yahoo [Bot] and 5 guests