Re: [AHK-] 如何計算關鍵字在字串中出現的次數

看板EzHotKey作者 (zipper)時間16年前 (2010/04/15 16:00), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串2/3 (看更多)
※ 引述《notlo (notlo)》之銘言: : 各位高手好.. : 我再來問個問題, : IfInString可判斷字串中有沒有含特定的關鍵字, : 那有沒有那個命令可計算關鍵字出現的次數呢?? : 例如:要怎麼知道"IfInString"裏總共有3個i呢?? : 謝謝大家了 研究了一下, 像這樣就可以 Haystack := "IfInString" NeedleRegEx :="i)i" StartingPosition = 1 Check: FoundPos := RegExMatch(Haystack, NeedleRegEx, "", StartingPosition) StartingPosition := FoundPos+1 If FoundPos { Count++ Goto Check } MsgBox %Count% -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 123.120.207.25
文章代碼(AID): #1BniUi4a (EzHotKey)
文章代碼(AID): #1BniUi4a (EzHotKey)