STRING MANIPULATION

1. Junior Member
Join Date
Dec 1969
Posts
3

STRING MANIPULATION

Can someone tell me if there is an easy way to tell if a certian character in a string is a number or letter. For example if I had the name LinuxRoc3ks if the third character, in this case 3, from the left is a letter I want to do one thing if it is a number I would like to do something else. Can someone tell me how to write this IF...THEN statement? Thank you.

2. Junior Member
Join Date
Dec 1969
Posts
3

RE: STRING MANIPULATION

I mean the third character from the right is 3. Sorry for the typo.

3. Senior Member
Join Date
Dec 1969
Posts
96,118

Mid, Len, and isNumeric functions...

&nbsp;<BR>txt = "LinuxRoc3ks"<BR>thirdFromRight = Mid( txt, Len(txt)-2, 1 )<BR>If isNumeric( thirdFromRight ) Then ...<BR><BR>*************<BR><BR>Another way to get 3rd from right:<BR><BR>txt = "LinuxRoc3ks"<BR>thirdFromRight = Left( Right( txt, 3 ), 1 )<BR>If isNumeric( thirdFromRight ) Then ...<BR><BR>See that? You first get the RIGHT-most 3 characters and then the LEFT-most 1 character of those three.<BR><BR>Of course, you can do it all in one step:<BR><BR>txt = "LinuxRoc3ks"<BR>If isNumeric( Left( Right( txt, 3 ), 1 ) ) Then ...<BR><BR>

Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•