@@ -868,8 +868,8 @@ pure subroutine split(str,token,chunk_size,vals)
868
868
integer ,intent (in ) :: chunk_size ! ! for expanding vectors
869
869
type (csv_string),dimension (:),allocatable ,intent (out ) :: vals
870
870
871
- integer :: i ! !
872
- integer :: len_str ! !
871
+ integer :: i
872
+ integer :: len_str
873
873
integer :: len_token ! ! length of the token
874
874
integer :: n_tokens ! ! number of tokens
875
875
integer :: i1 ! ! index
@@ -886,13 +886,13 @@ pure subroutine split(str,token,chunk_size,vals)
886
886
887
887
! first, count the number of times the token appears in the string
888
888
do
889
- len_str = len (temp) ! length of the string
890
- i = index (temp,token) ! location of the next token
891
- if (i<= 0 ) exit ! no more tokens found
889
+ len_str = len (temp) ! length of the string
890
+ i = index (temp,token) ! location of the next token
891
+ if (i<= 0 ) exit ! no more tokens found
892
892
call expand_vector(itokens,n_tokens,chunk_size,i+ j) ! save the token location
893
- if (i+ len_token> len_str) exit ! if the last bit of the string is a token
894
- j = j + i
895
- temp = temp(i+ len_token:len_str) ! remove previously scanned part of string
893
+ if (i+ len_token> len_str) exit ! if the last bit of the string is a token
894
+ j = j + i
895
+ temp = temp(i+ len_token:len_str) ! remove previously scanned part of string
896
896
end do
897
897
call expand_vector(itokens,n_tokens,chunk_size,finished= .true. ) ! resize the vector
898
898
@@ -905,9 +905,9 @@ pure subroutine split(str,token,chunk_size,vals)
905
905
i1 = 1
906
906
i2 = itokens(1 )- 1
907
907
if (n_tokens> 1 ) then
908
- vals(1 )% str = str(i1:i2)
908
+ vals(1 )% str = str(i1:i2)
909
909
else
910
- vals(1 )% str = ' ' ! the first character is a token
910
+ vals(1 )% str = ' ' ! the first character is a token
911
911
end if
912
912
913
913
! 1 2 3
@@ -917,7 +917,7 @@ pure subroutine split(str,token,chunk_size,vals)
917
917
i1 = itokens(i-1 )+ len_token
918
918
i2 = itokens(i)- 1
919
919
if (i2>= i1) then
920
- vals(i)% str = str(i1:i2)
920
+ vals(i)% str = str(i1:i2)
921
921
else
922
922
vals(i)% str = ' ' ! empty element (e.g., 'abc,,def')
923
923
end if
@@ -928,12 +928,12 @@ pure subroutine split(str,token,chunk_size,vals)
928
928
if (itokens(n_tokens)+ len_token<= len_str) then
929
929
vals(n_tokens+1 )% str = str(i1:i2)
930
930
else
931
- vals(n_tokens+1 )% str = ' ' ! the last character was a token
931
+ vals(n_tokens+1 )% str = ' ' ! the last character was a token
932
932
end if
933
933
934
934
else
935
- ! no tokens present, so just return the original string:
936
- vals(1 )% str = str
935
+ ! no tokens present, so just return the original string:
936
+ vals(1 )% str = str
937
937
end if
938
938
939
939
end subroutine split
0 commit comments