DirtDBaK Posted October 21, 2007 Posted October 21, 2007 How do i find the number of occurance of one string in a txt file like this I am really really fat... and you are really really whatever... and this would return the rusult for 'really' as 4 or the result of '.' as 6 I was thinking $num_of_occ = _StringOcc( 'I am really really fat... and you are really really whatever...', 'really' ) Func _StringOcc( $txt, $string ) $i = 1 $val = StringinStr( $txt, $string, 0, $i ) While $val <> 0 $i = $i + 1 $val = StringinStr( $txt, $string, 0, $i ) Wend Return $val EndFunc [center][/center]
Moderators SmOke_N Posted October 21, 2007 Moderators Posted October 21, 2007 Func _StrOccur($sString, $sFind) StringReplace($sString, $sFind, "") Return @extended EndFunc Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
DirtDBaK Posted October 21, 2007 Author Posted October 21, 2007 ok thanks ill try this out [center][/center]
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now