Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=:), | allocatable | :: | arr(:) | |||
character(len=*) | :: | string |
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
integer, | public | :: | end | ||||
integer, | public | :: | place |
subroutine update(arr,string)
character(len=:),allocatable :: arr(:)
character(len=*) :: string
integer :: place, end
end=size(arr)
! find where string is or should be
call locate(arr,string,place)
! if string was not found insert it
if(place.lt.1)then
call insert(arr,string,abs(place))
endif
! show array
end=size(arr)
write(*,'("array is now SIZE=",i0,1x,*(a,","))')end,(trim(arr(i)),i=1,end)
end subroutine update