Char.IsSymbol(“*”) is false

前端 未结 3 1789
清酒与你
清酒与你 2020-12-19 02:35

I\'m working on a password validation routine, and am surprised to find that VB does not consider \'*\' to be a symbol per the Char.IsSymbol() check. Here is the output from

3条回答
  •  执念已碎
    2020-12-19 03:37

    Maybe you have the compiler option "strict" of, because with

    Char.IsSymbol("*")
    

    I get a compiler error

    BC30512: Option Strict On disallows implicit conversions from 'String' to 'Char'.
    

    To define a Character literal in VB.NET, you must add a c to the string, like this:

    Char.IsSymbol("*"c)
    

提交回复
热议问题