Cropping the last two chars of a string of varying length

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?


  1. 1790 > 17
  2. 87094 > 870
  3. 675674 > 6756

Use the slice command in the set text action:

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)

1 Like

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)


1kg = 1000g,
so divide your first value by 1000:

(500 will become 500/1000=0.5 ;
50 => 50/1000=0.05 ;


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.