string - Like 运算符无法检测到字符串中的字符
问题描述
目前,我的代码无法正确检测字符串是否具有特定字符。
为了简单的解释。请参考这个:
Dim strSample as String = "Y1-K99"
如果字符串会检测到是否strSample
有字母K ,我尝试了这段代码。
If (strSample Like "##K*" Or strSample Like "###K*") Then
'Do Something
End if
If Else condition
但即使它有一个 K ,它也不会触发或转到内部函数。
解决方案
如果您在 "strSample has a letter K" 之后,则需要将 IF 条件更改为
If (strSample Like "*K*") Then
'Do Something
End if
阅读此 Like 运算符
推荐阅读
- swift - 获取核心数据日期作为字符串显示在标签上
- python - seaborn - 如何将平均条添加到按色调分组的条形图
- amazon-web-services - 有没有办法在 AWS 上使用 API 网关为第三方域构建 HTTP 代理?
- flutter - 用户注销时,FirebaseAuth.instance.onAuthStateChanged 不会触发流生成器
- c - 通过 C 中的 SOCKS5 代理服务器使用 Sockets 发送请求
- r - 代码示例后的问题。InformationValue::Woe
- javascript - 为什么我的选择器无效并抛出 Uncaught DOMException 错误?
- simulator - 使用耦合隔室和物种速率规则模拟 SBML 模型
- android - 如何使用 track.applyConstraints() 从 Android Studio Mega 上的 getUserMedia javascript 关闭火炬?
- javascript - TypeScript 和 TypeORM 中的分页和过滤