tokenizer_t Derived Type

type, public :: tokenizer_t


Components

Type Visibility Attributes Name Initial
character(len=:), public, pointer :: str => null()
character(len=:), public, pointer :: delims => null()

Type-Bound Procedures

procedure, public :: get => next_token

  • private function next_token(this, str, delim) result(res)

    @brief Split string on tokens, delimiting by specified set of symbols @author Vladimir Mironov @date Sept, 2021 @param this [inout] tokenizer_t instance @param str [in] optional, input string @param delim [in] optional, string containing delimiter symbols, default='' @param result pointer to the next token

    Note

    Delimiter instance saves its state after str and delim has been set up. At each successfull call user can redefine delim string The behavior is similar to C strtok function. Returns null pointer when line ends and resets tokenizer_t internal state. Example usage: fortran type(tokenizer_t) :: tokz character(:), pointer :: ptr ptr => tokz%get(str, ' ;,') do while (associated(ptr)) print *, ptr ptr => tokz%get() end do

    Note

    Do not use for csv reading!

    Arguments

    Type IntentOptional Attributes Name
    class(tokenizer_t) :: this
    character(len=*), intent(in), optional, target :: str
    character(len=*), intent(in), optional, target :: delim

    Return Value character(len=:), pointer