StrFind
This routine finds the pattern inside the string, and returns the indices.
Interface
- ܀ Interface
- ️܀ See example
- ↢
INTERFACE
MODULE PURE SUBROUTINE strFind(chars, pattern, indices)
CHARACTER(*), INTENT(IN) :: chars
CHARACTER(*), INTENT(IN) :: pattern
INTEGER(I4B), ALLOCATABLE, INTENT(OUT) :: indices(:)
END SUBROUTINE strFind
END INTERFACE
program main
use easifemBase
implicit none
CHARACTER( LEN = 100 ) :: astr="hello world, hello people!"
INTEGER( I4B ), allocatable :: indices(:)
CALL strFind(astr, "hello", indices)
CALL OK( ALL(indices .EQ. [1, 14] ), "test(1): " )
end program main