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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top