Removing trailing character in a string

1568
3
Jump to solution
05-08-2018 07:24 PM
BryanL
by
New Contributor II

Hello All,

I would like to get some help on the following issue that I encountered in ArcGis 10.3

The objective is to look through the whole string and remove just the "." from the string

Object ID        Field 

1                     Apple.

2                     Orange.

3                     Egg

4                     Pear

5                     Watermelon

I've tried using the following code which resulted in the all the last characters being removed instead of just "." :

Trim( LEFT ([Field], LEN( [Field]) -1))

I've also tried the code below which prompted an error message "Type mismatch" for both iif and InStr :

Trim(Left([Field], iif((InStr([Field], ".") = LEN([Field])), InStr([Field], ".")-1, LEN([Field]))))

I am using the Field Calculator in ArcGis 10.3.

Thanks for any help in advance.

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Bryan,

   You could use 

Replace([Field], ".", "")

View solution in original post

3 Replies
XanderBakker
Esri Esteemed Contributor

Use the Python parser and this:

!YourFieldName!.rstrip('.')
RobertScheitlin__GISP
MVP Emeritus

Bryan,

   You could use 

Replace([Field], ".", "")

BryanL
by
New Contributor II

Thank you guys for the help. Appreciate it.

I 've since managed to get the result.

Cheers

0 Kudos