!---------------------------------------------------------------------------- !---------------------------------------------------------------------------- !---------------------------------------------------------------------------- !+ ! subroutine tao_count_strings (string, pattern, num) ! ! Subroutine to count the number of a specific pattern in the string ! ! Input: ! string -- character(*): the string to look at ! pattern -- character(*): the search pattern ! ! Output: ! num -- integer: number of occurances !- subroutine tao_count_strings (string, pattern, num) implicit none character(*) string, pattern integer num, len_string, len_pattern, i num = 0 len_pattern = len(pattern) len_string = len(string) do i = 1, len(string) if (i+len_pattern-1 .gt. len_string) return if (string(i:i+len_pattern-1) .eq. pattern) num = num + 1 enddo end subroutine tao_count_strings