blob: 17f9aa277b67e650640ec23f60fb9b778dd43093 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
! Program to test the LEN and LEN_TRIM intrinsics.
subroutine test (c)
character(*) c
character(len(c)) d
d = c
if (len(d) .ne. 20) call abort
if (d .ne. "Longer Test String") call abort
c = "Hello World"
end subroutine
subroutine test2 (c)
character (*) c
character(len(c)) d
d = c
if (len(d) .ne. 6) call abort
if (d .ne. "Foobar") call abort
end subroutine
program strlen
implicit none
character(20) c
character(5) a, b
integer i
c = "Longer Test String"
call test (c)
if (len(c) .ne. 20) call abort
if (len_trim(c) .ne. 11) call abort
call test2 ("Foobar");
end program
|