\hypertarget{interfacem__cli2_1_1insert}{}\doxysection{m\+\_\+cli2\+::insert Interface Reference}
\label{interfacem__cli2_1_1insert}\index{m\_cli2::insert@{m\_cli2::insert}}
\doxysubsection*{Private Member Functions}
\begin{DoxyCompactItemize}
\item 
subroutine \mbox{\hyperlink{interfacem__cli2_1_1insert_af1a1ef419e4e9d4653fce92182e0e0c2}{insert\+\_\+c}} (list, value, place)
\item 
subroutine \mbox{\hyperlink{interfacem__cli2_1_1insert_a50fcaf89ea5907952b521845dd434835}{insert\+\_\+i}} (list, value, place)
\item 
subroutine \mbox{\hyperlink{interfacem__cli2_1_1insert_a48dedb7035fb157485c81de9fc245659}{insert\+\_\+l}} (list, value, place)
\end{DoxyCompactItemize}


\doxysubsection{Member Function/\+Subroutine Documentation}
\mbox{\Hypertarget{interfacem__cli2_1_1insert_af1a1ef419e4e9d4653fce92182e0e0c2}\label{interfacem__cli2_1_1insert_af1a1ef419e4e9d4653fce92182e0e0c2}} 
\index{m\_cli2::insert@{m\_cli2::insert}!insert\_c@{insert\_c}}
\index{insert\_c@{insert\_c}!m\_cli2::insert@{m\_cli2::insert}}
\doxysubsubsection{\texorpdfstring{insert\_c()}{insert\_c()}}
{\footnotesize\ttfamily subroutine m\+\_\+cli2\+::insert\+::insert\+\_\+c (\begin{DoxyParamCaption}\item[{character(len=\+:), dimension(\+:), allocatable}]{list,  }\item[{character(len=$\ast$), intent(in)}]{value,  }\item[{integer, intent(in)}]{place }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}

\hypertarget{namespacem__cli2_autotoc_md224}{}\doxysubsubsection{N\+A\+ME}\label{namespacem__cli2_autotoc_md224}
insert(3f) -\/ \mbox{[}M\+\_\+\+C\+L\+I2\mbox{]} insert entry into a string array at specified position (L\+I\+C\+E\+N\+SE\+:PD)\hypertarget{namespacem__cli2_autotoc_md225}{}\doxysubsubsection{S\+Y\+N\+O\+P\+S\+IS}\label{namespacem__cli2_autotoc_md225}
subroutine insert(list,value,place)

character(len=$\ast$)$\vert$doubleprecision$\vert$real$\vert$integer,intent(in) \+:: value character(len=\+:)$\vert$doubleprecision$\vert$real$\vert$integer,intent(in) \+:: list(\+:) integer,intent(in) \+:: place\hypertarget{namespacem__cli2_autotoc_md226}{}\doxysubsubsection{D\+E\+S\+C\+R\+I\+P\+T\+I\+ON}\label{namespacem__cli2_autotoc_md226}
\begin{DoxyVerb}Insert a value into an allocatable array at the specified index.
The list and value must be of the same type (CHARACTER, DOUBLEPRECISION,
REAL, or INTEGER)
\end{DoxyVerb}
\hypertarget{namespacem__cli2_autotoc_md227}{}\doxysubsubsection{O\+P\+T\+I\+O\+NS}\label{namespacem__cli2_autotoc_md227}
\begin{DoxyVerb}list    is the list array. Must be sorted in descending order.
value   the value to place in the array
PLACE   is the subscript that the entry should be placed at
\end{DoxyVerb}
\hypertarget{namespacem__cli2_autotoc_md228}{}\doxysubsubsection{E\+X\+A\+M\+P\+L\+ES}\label{namespacem__cli2_autotoc_md228}
Find if a string is in a sorted array, and insert the string into the list if it is not present ... \begin{DoxyVerb}program demo_insert
use M_sort, only : sort_shell
use M_CLI2, only : locate, insert
implicit none
character(len=:),allocatable :: arr(:)
integer                       :: i

arr=[character(len=20) :: '', 'ZZZ', 'aaa', 'b', 'xxx' ]
! make sure sorted in descending order
call sort_shell(arr,order='d')
! add or replace values
call update(arr,'b')
call update(arr,'[')
call update(arr,'c')
call update(arr,'ZZ')
call update(arr,'ZZZ')
call update(arr,'ZZZZ')
call update(arr,'')
call update(arr,'z')

contains
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
end program demo_insert
\end{DoxyVerb}


Results\+:

array is now S\+I\+ZE=5 xxx,b,aaa,Z\+ZZ,, array is now S\+I\+ZE=6 xxx,b,aaa,\mbox{[},Z\+ZZ,, array is now S\+I\+ZE=7 xxx,c,b,aaa,\mbox{[},Z\+ZZ,, array is now S\+I\+ZE=8 xxx,c,b,aaa,\mbox{[},Z\+ZZ,ZZ,, array is now S\+I\+ZE=9 xxx,c,b,aaa,\mbox{[},Z\+Z\+ZZ,Z\+ZZ,ZZ,, array is now S\+I\+ZE=10 z,xxx,c,b,aaa,\mbox{[},Z\+Z\+ZZ,Z\+ZZ,ZZ,,\hypertarget{namespacem__cli2_autotoc_md229}{}\doxysubsubsection{A\+U\+T\+H\+OR}\label{namespacem__cli2_autotoc_md229}
1989,2017 John S. Urban \hypertarget{namespacem__cli2_autotoc_md230}{}\doxysubsubsection{L\+I\+C\+E\+N\+SE}\label{namespacem__cli2_autotoc_md230}
Public Domain \mbox{\Hypertarget{interfacem__cli2_1_1insert_a50fcaf89ea5907952b521845dd434835}\label{interfacem__cli2_1_1insert_a50fcaf89ea5907952b521845dd434835}} 
\index{m\_cli2::insert@{m\_cli2::insert}!insert\_i@{insert\_i}}
\index{insert\_i@{insert\_i}!m\_cli2::insert@{m\_cli2::insert}}
\doxysubsubsection{\texorpdfstring{insert\_i()}{insert\_i()}}
{\footnotesize\ttfamily subroutine m\+\_\+cli2\+::insert\+::insert\+\_\+i (\begin{DoxyParamCaption}\item[{integer, dimension(\+:), allocatable}]{list,  }\item[{integer, intent(in)}]{value,  }\item[{integer, intent(in)}]{place }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}

\mbox{\Hypertarget{interfacem__cli2_1_1insert_a48dedb7035fb157485c81de9fc245659}\label{interfacem__cli2_1_1insert_a48dedb7035fb157485c81de9fc245659}} 
\index{m\_cli2::insert@{m\_cli2::insert}!insert\_l@{insert\_l}}
\index{insert\_l@{insert\_l}!m\_cli2::insert@{m\_cli2::insert}}
\doxysubsubsection{\texorpdfstring{insert\_l()}{insert\_l()}}
{\footnotesize\ttfamily subroutine m\+\_\+cli2\+::insert\+::insert\+\_\+l (\begin{DoxyParamCaption}\item[{logical, dimension(\+:), allocatable}]{list,  }\item[{logical, intent(in)}]{value,  }\item[{integer, intent(in)}]{place }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



The documentation for this interface was generated from the following file\+:\begin{DoxyCompactItemize}
\item 
/home/urbanjs/venus/\+V600/github/\+A\+R\+G\+S/\+M\+\_\+\+C\+L\+I2/src/\mbox{\hyperlink{M__CLI2_8f90}{M\+\_\+\+C\+L\+I2.\+f90}}\end{DoxyCompactItemize}
