中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-08-07 03:29
48,040 topics / 350,125 posts / today 1 new / 48,252 members
DOS批处理 & 脚本技术(批处理室) » Question about finding a string in VBS?
Printable Version  659 / 4
Floor1 lotus516 Posted 2007-12-29 12:16
高级用户 Posts 246 Credits 551
I have a text file with two identical strings in it, for example "Beijing". Right now I want to find the second one—how should I write that? I know how to find both of them (I can do it in both VBS and P, but I don't want the first one)!! Also, if there are multiple ones (10 or more), and I only want the fifth one, how should that be written? (I can implement the above in P, but the text is too large, and one run takes 2.3 minutes, so the efficiency is low, that's why I want a VBS solution!!)
Floor2 zh159 Posted 2007-12-29 12:21
金牌会员 Posts 1,467 Credits 3,687
Not on the same line?
Floor3 lxmxn Posted 2007-12-29 12:25
版主 Posts 4,938 Credits 11,386
The principle is the same: set up a counter, and it should be doable with regular expressions.
Floor4 zh159 Posted 2007-12-29 12:27
金牌会员 Posts 1,467 Credits 3,687
Right, you can count with something like If instr(read,str) > 0 Then i = i + 1
Floor5 lotus516 Posted 2007-12-29 12:27
高级用户 Posts 246 Credits 551
Not on the same line!!!
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023