ueiayz 发表于 2009-7-31 09:08:36

请问如何返回文本里指定字符串的位置?

请问如何返回文本里指定字符串的位置(所在行数)?

afan 发表于 2009-7-31 09:57:57

$str = '指定字符串'
$i= 1
While 1
$a = FileReadLine("1.txt",$i)
If @error = -1 then Exitloop
IF StringInStr($a, $str) <> 0 Then MsgBox (64, 0, $str & ' 在第 ' & $i & ' 行 ')
$i += 1
WEnd

ueiayz 发表于 2009-7-31 11:22:46

这么简单哇。我怎么就没发现FileReadLine的哩。汗。。。
谢谢
页: [1]
查看完整版本: 请问如何返回文本里指定字符串的位置?