vba - 数字是否在字符串中的特定位置?
问题描述
我只想知道是否可以检查字符串中特定位置是否有数字
Sub test()
Dim a As String
a = "TestTestTest12"
'If (the 13th and the 14th positon are numbers) Then ...
End Sub
解决方案
使用以下:
Function IsNumberAtPosition(s As String, pos As Integer) As Boolean
IsNumberAtPosition = IsNumeric(Mid(s, pos, 1))
End Function
用法:
IsNumberAtPosition("TestTestTest12", 13)
推荐阅读
- javascript - 如何从 JavaScript 中的 JSON 树获取嵌套的父路径?
- c++ - 如何将 OpenMP 和 MPI 导入大型 CLion CMake 项目?
- snowflake-cloud-data-platform - 如何在 SnowFlake 中加入 query_id 和 METADATA$ROW_ID
- python-3.x - 有什么方法可以找到多个图像的边界并单独裁剪它们?
- r - 从一系列网页中解析图表
- python - 将原始 CFA 缓冲区保存到原始图像
- javascript - 阿波罗客户端在反应原生的初始重新加载中返回未定义
- javascript - 如何使用私有方法正确配置 ES6 类的 eslint?
- c# - 在页面级别实现 Asp.NET core 2.2 Sessionstate 或 tempdata 等效项
- javascript - Ajax errorThrown:内部服务器错误,但状态为 4