VB.NET Like operator confusion with a picture less than familiar

Dim rc As Boolean = "2" Like "*?<*?"

I don’t understand why rc is True, certainly 2not at all like that *?<*?.

The above template requires a line with

  • At least three characters (two? And a <)
  • where the symbol <is somewhere inside.

As far as I can work, is <not a special character, which means something else, except <for the Like operator.

Using Visual Studio 2010.

+5
source share
1 answer

So far I can’t directly explain why it 2looks like "*?<*?".

Your request is being read;

  • * - match 0 or more characters
  • ? - next character
  • < - Following the symbol <
  • * - 0
  • ? -

;

, , "<" -

:

Dim rc As Boolean = "2" Like "???*<*"

;

  • ??? - 3
  • * -
  • < - <
  • * -

, , , ...

EDIT:

.

:

, "<" -

:

Dim rc As Boolean = "2" Like "*?<?*"

False, ;

Dim rc As Boolean = "<" Like "*?<?*"

Dim rc As Boolean = "2<2" Like "*?<?*"

true.

, (!)

+1

All Articles