Comparing first & last letter of a string

Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved

Join Date: Oct 2009
Posts: 16
Reputation: Lida_pink is an unknown quantity at this point 
Solved Threads: 0
Lida_pink Lida_pink is offline Offline
Newbie Poster

Comparing first & last letter of a string

 
0
  #1
Oct 25th, 2009
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
Reply With Quote Quick reply to this message  
Join Date: Mar 2009
Posts: 885
Reputation: vb5prgrmr will become famous soon enough vb5prgrmr will become famous soon enough 
Solved Threads: 165
vb5prgrmr vb5prgrmr is offline Offline
Practically a Posting Shark
 
0
  #2
Oct 25th, 2009
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
If anyone has helped you solve your problem, please mark your thread as solved.

Thanks
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for Visual Basic 4 / 5 / 6
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC