SOLVED
How to remove last character in a string when the charactuer is equal to "0"?
Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
kkkim
8 - Asteroid
‎07-18-2022
11:37 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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!!!!!!
Solved! Go to Solution.
Labels:
- Labels:
- Text Mining
2 REPLIES 2
Alteryx
‎07-18-2022
11:46 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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
‎07-18-2022
11:50 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Thank you, Brandon!!!
