Created
October 31, 2012 15:45
-
-
Save alanbriolat/3987781 to your computer and use it in GitHub Desktop.
Horrible indistinguishable Fortran strings
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
program strings | |
implicit none | |
character(len=20) :: a, b | |
print *, "strings: ", a, b | |
if (a == b) then | |
print *, "strings are equal" | |
endif | |
print *, "len(): ", len(a), len(b) | |
if (len(a) == len(b)) then | |
print *, "strings are equal length" | |
endif | |
print *, "len_trim(): ", len_trim(a), len_trim(b) | |
if (len_trim(a) == len_trim(b)) then | |
print *, "strings are equal len_trim", len_trim(a), len_trim(b) | |
endif | |
a = "foo" | |
b = "foo " | |
print *, "strings: ", a, b | |
if (a == b) then | |
print *, "strings are equal" | |
endif | |
print *, "len(): ", len(a), len(b) | |
if (len(a) == len(b)) then | |
print *, "strings are equal length" | |
endif | |
print *, "len_trim(): ", len_trim(a), len_trim(b) | |
if (len_trim(a) == len_trim(b)) then | |
print *, "strings are equal len_trim", len_trim(a), len_trim(b) | |
endif | |
end program |
Author
alanbriolat
commented
Oct 31, 2012
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment