This procedure find first comma and number of it in the given pattern. It aims to parse repetation times of the expression.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | str | |||
integer(kind=int32), | intent(inout) | :: | i | |||
integer(kind=int32), | intent(inout) | :: | count |
pure subroutine get_index_comma (str, i, count) use :: iso_fortran_env, only: int32 use :: forgex_parameters_m, only: comma => SYMBOL_COMMA, EMPTY_CHAR implicit none character(*), intent(in) :: str integer(int32), intent(inout) :: i, count integer(int32) :: j character(:), allocatable :: buf i = 0 j = 1 count = 0 buf = str do while (.true.) j = index(buf, comma) if (i == 0) i = j if (j == 0) exit buf = buf(1:j-1)//'.'//buf(j+1:len(buf)) count = count + 1 end do end subroutine get_index_comma