Re: Find What String Ends With
- From: "mayayana" <mayaXXyana1a@xxxxxxxxxxxxxxxx>
- Date: Wed, 14 Mar 2007 17:23:15 GMT
How can I check if my string ends with a certain substring or letter?
There is an excellent equivalent in Java endsWith("somestring") where
you can check if string ends in desired substring, then desired action
will be performed.
As Ayush said, you can do it easily with the
Right function. I also like to add UCase to
the operation. Right seems to be case-sensitive.
Sample:
Dim s
s = "abcd"
If right(s, 1) = "D" Then
MsgBox "ok"
Else
MsgBox "no"
End If
So a thorough-going approach is to use something
like:
If UCase(Right(s, 2)) = "CD" Then....
.
- Follow-Ups:
- Re: Find What String Ends With
- From: Paul Randall
- Re: Find What String Ends With
- References:
- Find What String Ends With
- From: vunet . us
- Find What String Ends With
- Prev by Date: Re: Find What String Ends With
- Next by Date: Re: Unicode to UTF8
- Previous by thread: Re: Find What String Ends With
- Next by thread: Re: Find What String Ends With
- Index(es):
Relevant Pages
|