VB.NET'中可能存在的错误;比如';操作人员
为什么下面的计算结果为VB.NET'中可能存在的错误;比如';操作人员,.net,vb.net,wildcard,string-matching,sql-like,.net,Vb.net,Wildcard,String Matching,Sql Like,为什么下面的计算结果为True Dim result = "b" Like "*a*b" 谢谢 编辑: 为了稍微概括一下,下面返回True: "String1" Like "*AnyText1*AnyText2*AnyText???******????*String1" VBA工作正常,返回False PowerShell工作正常,返回False: PS C:\Users\XXX> "b" -Like "*a*b" False 编辑2: 错误报告的链接: 为了好玩,我决定打开ilsp
True
Dim result = "b" Like "*a*b"
谢谢
编辑:为了稍微概括一下,下面返回
True
:
"String1" Like "*AnyText1*AnyText2*AnyText???******????*String1"
VBA工作正常,返回False
PowerShell工作正常,返回
False
:
PS C:\Users\XXX> "b" -Like "*a*b"
False
编辑2:错误报告的链接:
为了好玩,我决定打开ilspy来调试它:-) 在这种方法中
private static void MatchAsterisk(string Source, int SourceLength, int SourceIndex, LigatureInfo[] SourceLigatureInfo, string Pattern, int PatternLength, int PatternIndex, LigatureInfo[] PattternLigatureInfo, ref bool Mismatch, ref bool PatternError, CompareInfo Comparer, CompareOptions Options)
对于这种情况
if (SourceLength <= 0)
{
return;
}
但是当需要返回true时是否返回true您确定吗?在Visual Basic中返回
False
。当然在VB.NET.mono-2.4.2.3@mcu中也是一样的-如果您仍然需要该功能,可以使用正则表达式。“^(.*)a(.*)b$”@mcu,你能发布错误报告的链接吗?错误报告是,我在评论部分添加了我的答案
if (SourceLength < 0)
{
return;
}
Dim result = "b" Like "*a*b"
now return false
"String1" Like "*AnyText1*AnyText2*AnyText???******????*String1"
now return false