SysUtils.StrScan() 函数用于字符串类型?在哪里?
虽然 SysUtils.StrScan() 采用 PWideChar const 作为参数,但是否有类似 StrScan() 的用于 string/Unicodestring 类型的内置函数?
提前致谢。
While SysUtils.StrScan() takes PWideChar const as the parameter, is there a StrScan() like built-in function for string/Unicodestring type?
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
普通的旧式
Pos
对于大多数人来说已经足够好了案例。第二个参数只是一个单字符string
,而不是Char
。如果您要搜索的字符串没有嵌入空字符,那么您也可以直接使用
StrScan
;只需将字符串参数类型转换为 PChar 即可。StrScan
将在到达空字符时停止搜索。Plain old
Pos
will work well enough for most cases. The second parameter will simply be a one-characterstring
instead of aChar
.If the string you're searching through will not have embedded null characters, then you can also use
StrScan
directly; just type-cast the string parameter toPChar
.StrScan
will stop searching when it reaches the null character.