vb.net按式样比较字符串
‘#’ 单个数字
‘?’ 单个字符
‘*’ 任意字符
[charlist] 字符列表中的单个字符
[!charlist] 非字符列表中的单个字符
举例:
“#123” LIke “#23” True
(但是“#23” LIke “#123” False)
“Hello” Like “H?llo” True
“Hello” Like “H*” True
“X” Like “[D-Z]” False
“X” LIke “[!D-Z]” False
代码实际演示:
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim result As Boolean
result = "1123" Like "#123"
Label1.Text = result
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim result As Boolean
result = "#123" Like "1123"
Label1.Text = result
End Sub
有时间需要认真总结一下vb的字符串比较问题,比如vb变量不区分大小写,字符串区分吗?
Like, equals()、compareTo、直接相等(‘=’单等号的用法,‘==’ 双等号的用法),有什么区别具体怎么用
大家好,我是[爱做梦的子浩](https://blog.csdn.net/weixin_43124279),我是东北大学大数据实验班大三的小菜鸡,非常向往优秀,羡慕优秀的人,已拿两个暑假offer,欢迎大家找我进行交流😂😂😂
这是我的博客地址:[子浩的博客https://blog.csdn.net/weixin_43124279]
——
版权声明:本文为CSDN博主「爱做梦的子浩」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。