How can i Get Last 2 number if i have 20304050
result 50
how i can do this
Hi Andrew,
Imagine your number is stored on the variable InputNumber, you can get it with the following expression:
What it does: it checks if the text / number has over 2 characters / digits: if it does, it returns the last 2 digits, otherwise, it returns the text / number itself.
Kind Regards,João
Hi Andrew Mahfouz Hanna,
you can use substr function
Substr(numbervariable,Length(numbervariable)-2,Length(numbervariable))
results 1
result 2
result 3
hope this helps
Thanks
Prince
If you have a Text variable, use Substr(), like others have suggested. If you have an Integer, use Mod() like this: Mod(InputInteger, 100). It will result in the last two digits in an Integer.
I fully agree with the solution provided by Kilian, You shouldn't convert types if not needed, in small operations this won't be visible as a performance hit, but on larger scales where every CPU cycle counts you don't want to cast between types if not needed