944,025 Members | Top Members by Rank

Ad:
Oct 25th, 2009
0

Comparing first & last letter of a string

Expand Post »
How can I check whether the first and last letter of a string are same or not? And if yes, a message should be shown using MsgBox.

Thanks in advance,
Lida
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Lida_pink is offline Offline
19 posts
since Oct 2009
Oct 25th, 2009
0
Re: Comparing first & last letter of a string
None Case Sensitive
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Option Explicit
  2. Option Compare Text
  3.  
  4. Private Sub Form_Load()
  5. Dim S As String
  6. S = "This is a test"
  7. If Left(S, 1) = Right(S, 1) Then MsgBox Left(S, 1) & " matches"
  8. End Sub
For case sensitive remove the option compare text....



Good Luck
Reputation Points: 156
Solved Threads: 296
Posting Virtuoso
vb5prgrmr is offline Offline
1,670 posts
since Mar 2009

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: Ur Help Needed
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: Help a Brazilian programmer urgent, please!





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC