Drop Char if Letter

  • Thread starter Thread starter RB
  • Start date Start date
R

RB

I need to drop the last character of a field if it's a
letter. Trim wont work 'cause it might be in position 5
or 6....any ideas
 
Public Function DropChar (StringIn as String) AS String
dim str as string
str=right(StringIn,1)
if isnumeric(str) then
DropChar=StringIn
Else
DropChar=left(StringIn,Len(StringIn)-1)
end if
End Function

If you need a more stringent criterion for "letter" (e.g. $^%&* are OK),
you can build a stronger IF clause.

HTH
- Turtle
 
Back
Top