| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| character(len=:), | public, | pointer | :: | str | => | null() | |
| character(len=:), | public, | pointer | :: | delims | => | null() |
@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!
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(tokenizer_t) | :: | this | ||||
| character(len=*), | intent(in), | optional, | target | :: | str | |
| character(len=*), | intent(in), | optional, | target | :: | delim |