Can any of you good folk tell me how I go about cutting/trimming/ cropping the last two chars of a given string of varying length?
eg:
- 1790 > 17
- 87094 > 870
- 675674 > 6756
Can any of you good folk tell me how I go about cutting/trimming/ cropping the last two chars of a given string of varying length?
eg:
Use the slice command in the set text action:
[[LVAR1.slice(0,-2)]]
Where LVAR1 is the text on the widget you want to remove the last two characters…
See attached sample - i’m setting it on text change of the text field, but you can do the same thing any other place.
remove Last Two Characters.rp (45.4 KB)
Thank you for the swift response, if you don’t mind I have one more. How would I translate these?
500 > 0.5
50 > 0.05
1500 > 1.5
(g > kg)
Hi,
1kg = 1000g,
so divide your first value by 1000:
(500 will become 500/1000=0.5 ;
50 => 50/1000=0.05 ;
…)
Best
That’s a lot more straightforward than I thought it would be, thank you both.
Apologies for the noob questions
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.