Jump to content

How do i find the number of occurance of one string in a txt file


 Share

Recommended Posts

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]

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...