Wild card sarch in VB/VB.net

  • Thread starter Thread starter Balaji
  • Start date Start date
B

Balaji

Hi,
Could u please let me know how I can do wildcard search in VB.
Examples:
Source string : "Microsoft Dotnet"
Wildcard string M*Dot*
Result should be Microsoft Dotnet

If
Wildcard string is M*Dot
Result should be "Match not found"
If
Wildcard string is M?c*Dot
Result should be Microsoft Dotnet

Your help will be greatly appreciated.
Thanks,
Balaji
 
Hi,

In addition to Cor's comments you can use like to compare strings

Dim strTest As String = "Microsoft Dotnet"

If strTest Like "M*Dot*" Then MessageBox.Show("Wildcard match")



Ken
 
* "Ken Tucker said:
In addition to Cor's comments you can use like to compare strings

Dim strTest As String = "Microsoft Dotnet"

If strTest Like "M*Dot*" Then MessageBox.Show("Wildcard match")

Full ACK, but don't forget that 'Like' is still buggy in some
situations.
 
Back
Top