string Derived Type

type, public :: string

a type containing an allocatable character string. so we can have an array of strings of different lengths.


Components

Type Visibility Attributes Name Initial
character(len=:), public, allocatable :: str

Type-Bound Procedures

procedure, public :: to_int => string_to_int

convert to integer

  • private pure elemental function string_to_int(me) result(i)

    Basic string to integer routine

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: me

    Return Value integer

procedure, public :: to_int_64 => string_to_int_64

  • private pure elemental function string_to_int_64(me) result(i)

    Basic string to integer routine

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: me

    Return Value integer(kind=ip)

Source Code

    type,public :: string
        !! a type containing an allocatable character string.
        !! so we can have an array of strings of different lengths.
        character(len=:),allocatable :: str
        contains
        procedure,public :: to_int    => string_to_int !! convert to integer
        procedure,public :: to_int_64 => string_to_int_64
    end type string