M_CLI2
M_CLI2 module (Fortran)
Private Member Functions | List of all members
m_cli2::remove Interface Reference

Private Member Functions

subroutine remove_c (list, place)
 
subroutine remove_i (list, place)
 
subroutine remove_l (list, place)
 

Member Function/Subroutine Documentation

◆ remove_c()

subroutine m_cli2::remove::remove_c ( character(len=:), dimension(:), allocatable  list,
integer, intent(in)  place 
)
private

NAME

remove(3f) - [M_CLI2] remove entry from an allocatable array at specified position (LICENSE:PD)

SYNOPSIS

subroutine remove(list,place)

character(len=:)|doubleprecision|real|integer,intent(inout) :: list(:) integer, intent(out) :: PLACE

DESCRIPTION

Remove a value from an allocatable array at the specified index.
The array is assumed to be sorted in descending order. It may be of
type CHARACTER, DOUBLEPRECISION, REAL, or INTEGER.

OPTIONS

list    is the list array.
PLACE   is the subscript for the entry that should be removed

EXAMPLES

Sample program

program demo_remove
use M_sort, only : sort_shell
use M_CLI2, only : locate, remove
implicit none
character(len=:),allocatable :: arr(:)
integer                       :: i
integer                       :: end

arr=[character(len=20) :: '', 'ZZZ', 'Z', 'aaa', 'b', 'b', 'ab', 'bb', 'xxx' ]
! make sure sorted in descending order
call sort_shell(arr,order='d')

end=size(arr)
write(*,'("SIZE=",i0,1x,*(a,","))')end,(trim(arr(i)),i=1,end)
call remove(arr,1)
end=size(arr)
write(*,'("SIZE=",i0,1x,*(a,","))')end,(trim(arr(i)),i=1,end)
call remove(arr,4)
end=size(arr)
write(*,'("SIZE=",i0,1x,*(a,","))')end,(trim(arr(i)),i=1,end)

end program demo_remove

Results:

Expected output

SIZE=9 xxx,bb,b,b,ab,aaa,ZZZ,Z,, SIZE=8 bb,b,b,ab,aaa,ZZZ,Z,, SIZE=7 bb,b,b,aaa,ZZZ,Z,,

AUTHOR

1989,2017 John S. Urban

LICENSE

Public Domain

◆ remove_i()

subroutine m_cli2::remove::remove_i ( integer, dimension(:), allocatable  list,
integer, intent(in)  place 
)
private

◆ remove_l()

subroutine m_cli2::remove::remove_l ( logical, dimension(:), allocatable  list,
integer, intent(in)  place 
)
private

The documentation for this interface was generated from the following file: