Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

How to remove last character in a string when the charactuer is equal to "0"?

kkkim
8 - Asteroid

Hi, Alteryx Experts:

 

I am looking to remove "0" at the end of a strring. For example:

 

1.1250

 

I would like to shorten this to

 

1.125

 

However if we have this number

6000

 

This should be left as

6000

 

So the formula should only be valid for those with decimal points and only if last digit is equal to "0" - then remove that "0".

 

Is there a good regex language I can write in the formula to make this happen?

 

Thank you so much for your help in advance!!!!!!

2 REPLIES 2
BrandonB
Alteryx
Alteryx

Assuming that the String column is stored as a string and not a number:

 

IF Contains([String], ".") AND Right([String], 1) = "0"

THEN Left([String], Length([String])-1)

ELSE [String]

ENDIF

kkkim
8 - Asteroid

Thank you, Brandon!!!

Labels
Top Solution Authors