写了4个方法
1.
[au3]$a = "How much wood could a woodchuck chuck is a woodchuck could chuck wood?"
$b = StringRegExp($a, 'wood', 3)
MsgBox(0, 0, UBound($b))[/au3]
2.
[au3]$num = 0
$i = 0
While 1
$a=StringRight($a, StringLen($a) - $num)
$num = StringInStr($a, "wood")
If $Num = 0 Then
ExitLoop
Else
$i += 1
EndIf
WEnd
MsgBox(0,0,$i)[/au3]
3.
[au3]$i=0
While 1
$string=StringInStr($a,"wood",0,$i+1)
If $string=0 Then
ExitLoop
Else
$i+=1
EndIf
WEnd
MsgBox(0,0,$i)[/au3]
4.
[au3]MsgBox(0, 0,UBound(StringSplit($a, "wood", 1))-2)[/au3]
[ 本帖最后由 大绯狼 于 2008-12-6 11:10 编辑 ] |