获取字符串中 某个字符或者某个字符串的个数
2016-05-05 11:55
295 查看
全部代码:
效果:
Module Module1 Sub Main() Debug.Print($"过程:{New StackTrace().GetFrame(0).GetMethod.Name} 方法1") Dim str = "7f 7f 00 00 ad 00 00 00 00 00 0d 0a 00 00 00 ad" Dim adCount = UBound(Split(str, "ad")) Debug.Print($"过程:{New StackTrace().GetFrame(0).GetMethod.Name} ad的个数:{adCount}") For Each ad In Split(str, "ad") Debug.Print($"过程:{New StackTrace().GetFrame(0).GetMethod.Name} 用ad分割出来的结果分别是:{ad}") Next Debug.Print($"过程:{New StackTrace().GetFrame(0).GetMethod.Name} 方法2") Dim adQuery = From ad In Split(str, " ") Where ad.ToLowerInvariant() = "ad".ToLowerInvariant() Select ad Debug.Print($"过程:{New StackTrace().GetFrame(0).GetMethod.Name} ad的个数:{adQuery.Count}") Debug.Print($"过程:{New StackTrace().GetFrame(0).GetMethod.Name} 方法3") Debug.Print($"过程:{New StackTrace().GetFrame(0).GetMethod.Name} ad的个数:{Split(str, " ").Count(Function(ad) ad = "ad")}") End Sub End Module
效果:
相关文章推荐
- 手把手教你VB.NET七层设计思路(一)
- 定义函数检索窗体中所有文本框是否为空
- VB.NET机房收费系统SQLHelper
- VB.NET小区物业管理系统
- 第二次机房重构-用例图
- windows 批量改名小工具
- vs visual studio 2017 片段行为 在标识符后键入 ?-Tab 时包含片段 智能提示(IntelliSense)
- 小记 字符串内插($)与String.Format 编译后效果一样
- .NET程序的性能要领和优化建议
- vb.net DirectoryNotFoundException UnauthorizedAccessException FileSystem.GetFiles获取文件 异常 权限解决
- SQL SQLite 筛选(查询)出 重复数据
- C# 还是 VB.net ,语言选择
- VB.NET 通过MySQLDriverCS连接Mysql
- vb.net第一课(第1小节)你好世界
- VS2015配置.Net(C#/VB)-MySQL开发环境
- 在vb.net 中使用mediaPlayer控件
- VB.net APP.config 实体化访问 configurationsection_《Visual Basic 2008 高级编程》 实例改新
- 使用doublebuffered来解决VB.net中datagridview数据显示和滚动慢和卡顿的问题
- VB.NET中的for循环
- VBA获取excel行和列