Re: How to compare two strings in 77?
- From: "David Flower" <DavJFlower@xxxxxxx>
- Date: 30 Jan 2006 05:52:36 -0800
jane.sync@xxxxxxxxx wrote:
> I thought I could test two strings with the code below, but it doesn't
> work. I'm passing a string into the function below, but the result is
> always 'not equal'. How are strings compared in Fortran 77? Thanks.
>
> function evaluateinput(str1) result(string)
> implicit none
> character(12) str1
> character(12) string
> if (str1 .EQ. 'test') then
> string = 'equal'
> else
> string = 'not equal'
> endif
> return
> end
Well, certainly not in the above code, which is not FORTRAN 77. Try
CHARACTER*9 FUNCTION string ( str1 )
IMPLICIT NONE
CHARACTER*(*) str1
IF ( str1 .EQ. 'test' ) THEN
string = 'equal'
ELSE
string = 'not equal'
END IF
RETURN
END
Dave Flower
.
- References:
- How to compare two strings in 77?
- From: jane . sync
- How to compare two strings in 77?
- Prev by Date: Re: Fortran DLL-Interface to Delphi
- Next by Date: Re: Are generic linked lists possible in Fortran95?
- Previous by thread: Re: How to compare two strings?
- Next by thread: Re: How to compare two strings?
- Index(es):
Relevant Pages
|
|