Loading...
Searching...
No Matches

Definition

Return the length of a string object.

This generic interface extends the intrinsic Fortran len function to support the fpx string type.

The returned value corresponds to the full length of the underlying character storage, including trailing blanks.

If the string is not allocated, the returned value is zero.

Examples

Basic usage:

type(string) :: s
s = 'foo'
print *, len(s) ! 3
s = 'foo '
print *, len(s) ! 4

Unallocated strings:

type(string) :: s
print *, len(s) ! 0

Definition at line 164 of file string.f90.


The documentation for this interface was generated from the following file:

Methods

◆ string_len()

elemental integer function string_len ( class(string), intent(in) this)

Length of the string entity.

Parameters
[in]thisstring

Examples

type(string) :: s
integer :: l
s = string('foo ')
l = len(s)
! the value of l is 4
Returns
An integer corresponding to the length of the string.

Definition at line 460 of file string.f90.