Re: compare two dynamic string




"TC" <tecomeco@xxxxxxxxx> wrote in message
news:CNl8f.12360$65.343462@xxxxxxxxxxxxxxxxxxxxx
> Rich Townsend ha scritto:
>> TC wrote:
>>
>>> How compare two dynamic string?
> character,allocatable :: Parola (:)
> character,allocatable :: P (:)
>
> ??? if (Parola < P) then
> and = >

Ignore Rich when he tries to convince you to use his humonguous Varying
String module that cant do read/write ,
its not needed..

! ---------------------------------
program compare_dynamic_char_arrays
character,allocatable :: Parola (:)
character,allocatable :: P (:)
character(10) :: string1, string2 = '1234567890'

allocate ( Parola(10), P(10) )

P = transfer(string2, P) ! init char arrays as equal
Parola = P

if ( transfer(Parola,string1) < transfer(P,string2) ) then
write (*,*) 'Parola < P'
else
write (*,*) 'Parola <= P' ! is the output
end if
end program


.