How to find the last element in a string

Hi all,

I have a requirement…

For eg: If a string has a value…lets say 1234.50

I must do left padding with zeroes and remove the decimal to a length of 13.

I have done till that…the output is 0000000123450. Now, My requirement is that…the last digit has 0 value…so i have to replace it with {

if the last digit is 1 i must replace it with A.
2 with B and so on.

So, For eg…here 0000000123450 must appear as 000000012345{
0000000123451 must appear as 000000012345A
0000000123452 must appear as 000000012345B

Can anyone tell the logic how to replace the last digit. If possible, please include the steps…so that it would be clear for me.

Thanks in advance,

Hi David

Use pub.string:substring and set beginIndex =13 and endIndex =14.
Then add a branch then paste the /value in the Switch property.
After that add Sequences below the branch and label each one 0,1,2,…,9.
In the sequence with the label 0 add a pub.string:substring below it and take the first 14 digit then add pub.string:concat to concatenate the value retuen with the { symbol.

Thats all.

Thank you very much alamir. That really worked.

My pleasure

What you’re describing as the target format is known as zoned decimal. The PSUtilities package from SAG/wM has a convertStringToZonedDecimal service you can copy. It handles leading signs, negative numbers, padding, stripping the decimal, etc.