Loading...
Searching...
No Matches
string Module Reference

Definition

Represents text as a sequence of ASCII code units. The derived type wraps an allocatable character array.

Examples

type(string) :: s
s = 'foo'

Remarks

The string implementation proposed here is kept at the bare minimum of what is required by the library. There are many other implementations that can be found.

Constructors

Initializes a new instance of the string class

string(character(:))

type(string) function string(character(:) chars) 
Parameters
[in]chars

Examples

type(string) :: s
s = string('foo')

Definition at line 37 of file String.f90.


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

Variables

character(:), allocatable chars
 Variable length character array.
 

Methods

◆ assignment() [1/2]

generic, public assignment ( class(string), intent(inout) lhs,
character(*), intent(in) rhs )

Assignment overloading. Assign a character array to a string.

Parameters
[in,out]lhsstring
[in]rhscharacter(*)

Examples

type(string) :: s
s = 'foo'

Remarks

Definition at line 43 of file String.f90.

◆ assignment() [2/2]

generic, public assignment ( character(*), intent(inout), allocatable lhs,
class(string), intent(in) rhs )

Assignment overloading. Assign a string to a character array.

Parameters
[in,out]lhscharacter(*), allocatable
[in]rhsstring

Examples

type(string) :: s
character(:), allocatable :: c
s = 'foo'
c = s
! the value of c is now 'foo'

Remarks

Definition at line 43 of file String.f90.

◆ len()

procedure, pass, public len ( class(string), intent(in) this)

Length of the string entity.

Parameters
[in]thisstring

Examples

type(string) :: s
integer :: l
s = string('foo')
l = s%len()
! the value of l is 3
Returns
An integer cooresponding to the length of the string

Definition at line 40 of file String.f90.