Skip to content

Commit e1005eb

Browse files
committed
formatting
1 parent 42b9ac0 commit e1005eb

File tree

1 file changed

+39
-39
lines changed

1 file changed

+39
-39
lines changed

src/csv_module.f90

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1100,57 +1100,57 @@ pure subroutine split(str,token,chunk_size,vals)
11001100
integer,dimension(:),allocatable :: itokens
11011101
logical :: finished !! if we are finished counting the tokens
11021102

1103-
temp = str !make a copy of the string
1104-
len_token = len(token) !length of the token
1105-
n_tokens = 0 !initialize the number of token counter
1106-
j = 0 !length of string removed
1103+
temp = str ! make a copy of the string
1104+
len_token = len(token) ! length of the token
1105+
n_tokens = 0 ! initialize the number of token counter
1106+
j = 0 ! length of string removed
11071107

11081108
!first, count the number of times the token appears in the string
11091109
do
1110-
len_str = len(temp) ! length of the string
1111-
i = index(temp,token) ! location of the next token
1112-
if (i<=0) exit ! no more tokens found
1110+
len_str = len(temp) ! length of the string
1111+
i = index(temp,token) ! location of the next token
1112+
if (i<=0) exit ! no more tokens found
11131113
call expand_vector(itokens,n_tokens,chunk_size,i+j) ! save the token location
1114-
if (i+len_token>len_str) exit ! if the last bit of the string is a token
1114+
if (i+len_token>len_str) exit ! if the last bit of the string is a token
11151115
j = j + i
1116-
temp = temp(i+len_token:len_str) !remove previously scanned part of string
1116+
temp = temp(i+len_token:len_str) !remove previously scanned part of string
11171117
end do
11181118
call expand_vector(itokens,n_tokens,chunk_size,finished=.true.) ! resize the vector
11191119

11201120
allocate(vals(n_tokens+1))
11211121

11221122
if (n_tokens>0) then
11231123

1124-
len_str = len(str)
1125-
1126-
i1 = 1
1127-
i2 = itokens(1)-1
1128-
if (n_tokens>1) then
1129-
vals(1)%str = str(i1:i2)
1130-
else
1131-
vals(1)%str = '' !the first character is a token
1132-
end if
1133-
1134-
! 1 2 3
1135-
! 'a,b,c,d'
1136-
1137-
do i=2,n_tokens
1138-
i1 = itokens(i-1)+len_token
1139-
i2 = itokens(i)-1
1140-
if (i2>=i1) then
1141-
vals(i)%str = str(i1:i2)
1142-
else
1143-
vals(i)%str = '' !empty element (e.g., 'abc,,def')
1144-
end if
1145-
end do
1146-
1147-
i1 = itokens(n_tokens) + len_token
1148-
i2 = len_str
1149-
if (itokens(n_tokens)+len_token<=len_str) then
1150-
vals(n_tokens+1)%str = str(i1:i2)
1151-
else
1152-
vals(n_tokens+1)%str = '' !the last character was a token
1153-
end if
1124+
len_str = len(str)
1125+
1126+
i1 = 1
1127+
i2 = itokens(1)-1
1128+
if (n_tokens>1) then
1129+
vals(1)%str = str(i1:i2)
1130+
else
1131+
vals(1)%str = '' !the first character is a token
1132+
end if
1133+
1134+
! 1 2 3
1135+
! 'a,b,c,d'
1136+
1137+
do i=2,n_tokens
1138+
i1 = itokens(i-1)+len_token
1139+
i2 = itokens(i)-1
1140+
if (i2>=i1) then
1141+
vals(i)%str = str(i1:i2)
1142+
else
1143+
vals(i)%str = '' !empty element (e.g., 'abc,,def')
1144+
end if
1145+
end do
1146+
1147+
i1 = itokens(n_tokens) + len_token
1148+
i2 = len_str
1149+
if (itokens(n_tokens)+len_token<=len_str) then
1150+
vals(n_tokens+1)%str = str(i1:i2)
1151+
else
1152+
vals(n_tokens+1)%str = '' !the last character was a token
1153+
end if
11541154

11551155
else
11561156
!no tokens present, so just return the original string:

0 commit comments

Comments
 (0)