hi,
how to compare part of the string
ex:
i have XX-BP-XXXXXXXXXXXXXXX

i want to check wherther the string starts with XX-BP
how can i do that

Hi,

use any of these:
Suppose
MyStr ="XX-BP-XXXXXXXXXXXXXXX"

If MyStr Like "XX-BP*" Then
  MsgBox "True"
Else
  MsgBox "False
End If

Or

If Left(MyStr,5) = "XX-BP" Then
  MsgBox "True"
Else
  MsgBox "False
End If

Or

If InStr(MyStr ,"XX-BP")>0  Then
  MsgBox "True"
Else
  MsgBox "False
End If

Regards
Veena

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.