Debian Codegraph @

doc/src/intrinsics/character/len_trim.md

raw
1 # len_trim(string): Length Ignoring Trailing Blanks
2
3 Length of a character string ignoring trailing blank character(s).
4
5 ## Declaration
6
7 ### Syntax
8
9 ```fortran
10 retval = len_trim(string)
11 integer elemental function len_trim(string)
12 ```
13
14 ### Arguments
15
16 `string` the input value of character type.
17
18 ### Return value
19
20 The return value is of type unsigned integer.
21
22 ## Description
23
24 **len_trim(string)** returns the length of the character argument without
25 including trailing blank character(s).
26
27 ## Types
28
29 Supported argument type is character scalar.
30
31 ```fortran
32
33 interface repeat
34 module procedure repeati32, repeati64
35 end interface
36
37 contains
38
39 integer elemental function len_trim(string)
40 character(len=*), intent(in) :: string
41 end function
42 ```
43
44 ## Examples
45
46 ```fortran
47 program intrinsics_len_trim
48 implicit none
49 character(*), parameter :: s1 = " A B "
50 integer:: retval
51 retval = len_trim(s1)
52 print *, retval
53 end program
54 ```
55
56 **Result:**
57
58 ```
59 4
60 ```
61
62 ## See Also
63
64 [lge](lge.md).