StringClass Module



Variables

Type Visibility Attributes Name Initial
integer(kind=int32), public, parameter :: ascii = selected_char_kind('ASCII')

Interfaces

public interface replace

It replaces a character into another.

  • public recursive subroutine replaceChar(word, keyword, to)

    Arguments

    Type IntentOptional Attributes Name
    character(len=*), intent(inout) :: word
    character(len=*), intent(in) :: keyword
    character(len=*), intent(in) :: to

public interface operator(+)

It merges two strings.

  • public function addstring(x, y) result(z)

    Arguments

    Type IntentOptional Attributes Name
    type(string_), intent(in) :: x
    type(string_), intent(in) :: y

    Return Value type(string_)

  • public function addstringchar(x, y) result(z)

    Arguments

    Type IntentOptional Attributes Name
    type(string_), intent(in) :: x
    character(len=*), intent(in) :: y

    Return Value type(string_)

  • public function addcharstring(y, x) result(z)

    Arguments

    Type IntentOptional Attributes Name
    character(len=*), intent(in) :: y
    type(string_), intent(in) :: x

    Return Value type(string_)

public interface assignment(=)

It assigns a string.

  • public subroutine assignstring(x, y)

    Arguments

    Type IntentOptional Attributes Name
    type(string_), intent(out) :: x
    character(len=*), intent(in) :: y

public interface print

It shows the string in the terminal.

  • public subroutine printString(this)

    Arguments

    Type IntentOptional Attributes Name
    class(string_), intent(in) :: this
  • public subroutine printStringVec(this)

    Arguments

    Type IntentOptional Attributes Name
    class(string_), intent(in) :: this(:)
  • public subroutine printStringArray(this)

    Arguments

    Type IntentOptional Attributes Name
    class(string_), intent(in) :: this(:,:)

public interface operator(+)

It marges two arrays of characters to a string.

  • public pure function addCharChar(char1, char2) result(char3)

    Arguments

    Type IntentOptional Attributes Name
    character(len=*), intent(in) :: char1
    character(len=*), intent(in) :: char2

    Return Value character(len=:), allocatable

public interface operator(.in.)

It detects whether a array of character is contained in the string or not.

  • public function in_detect_char(key, chararg) result(ret)

    Arguments

    Type IntentOptional Attributes Name
    character(len=*), intent(in) :: key
    character(len=*), intent(in) :: chararg

    Return Value logical


Derived Types

type, public ::  string_

Derived type for string object.

Components

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

Type-Bound Procedures

procedure, public :: char => charString ../../../

It returns the string to array of character.

procedure, public :: str => charString ../../../

It initializes the string by an array of character.

procedure, public :: print => printString ../../../

It shows the string in the terminal.

procedure, public :: lower => lowerString ../../../

It converts the CAPITAL to the lowercase

procedure, public :: upper => upperString ../../../

It converts the lowercase to the CAPITAL


Functions

public function ascii_lowercaseString(this) result(ret)

Arguments

Type IntentOptional Attributes Name
class(string_), intent(in) :: this

Return Value character(len=:), allocatable

public function charString(this) result(ret)

Arguments

Type IntentOptional Attributes Name
class(string_), intent(in) :: this

Return Value character(len=:), allocatable

public function addstring(x, y) result(z)

Arguments

Type IntentOptional Attributes Name
type(string_), intent(in) :: x
type(string_), intent(in) :: y

Return Value type(string_)

public function addstringchar(x, y) result(z)

Arguments

Type IntentOptional Attributes Name
type(string_), intent(in) :: x
character(len=*), intent(in) :: y

Return Value type(string_)

public function addcharstring(y, x) result(z)

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: y
type(string_), intent(in) :: x

Return Value type(string_)

public function lowerString(this) result(ret)

Arguments

Type IntentOptional Attributes Name
class(string_), intent(inout) :: this

Return Value type(string_)

public function upperString(this) result(ret)

Arguments

Type IntentOptional Attributes Name
class(string_), intent(inout) :: this

Return Value type(string_)

public pure function addCharChar(char1, char2) result(char3)

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: char1
character(len=*), intent(in) :: char2

Return Value character(len=:), allocatable

public function in_detect_char(key, chararg) result(ret)

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: key
character(len=*), intent(in) :: chararg

Return Value logical


Subroutines

public subroutine assignstring(x, y)

Arguments

Type IntentOptional Attributes Name
type(string_), intent(out) :: x
character(len=*), intent(in) :: y

public subroutine printString(this)

Arguments

Type IntentOptional Attributes Name
class(string_), intent(in) :: this

public subroutine printStringVec(this)

Arguments

Type IntentOptional Attributes Name
class(string_), intent(in) :: this(:)

public subroutine printStringArray(this)

Arguments

Type IntentOptional Attributes Name
class(string_), intent(in) :: this(:,:)

public recursive subroutine replaceChar(word, keyword, to)

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(inout) :: word
character(len=*), intent(in) :: keyword
character(len=*), intent(in) :: to