String helpers.
Builds a string by appending pieces in amortized constant time.
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| character(len=:), | private, | allocatable | :: | buf |
storage; only |
||
| integer, | private | :: | n | = | 0 |
length of the string so far |
| procedure, public :: append => builder_append | |
| procedure, public :: get => builder_get | |
| procedure, public :: length => builder_length |
A variable-length string, for arrays of strings of different lengths.
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| character(len=:), | public, | allocatable | :: | s |
the string |
The string built so far.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(string_builder_t), | intent(in) | :: | self |
the builder |
Length of the string built so far.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(string_builder_t), | intent(in) | :: | self |
the builder |
Number of characters of i as text, with any sign.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | i |
the number |
c in lowercase (ASCII letters only; other bytes, including UTF-8, are unchanged).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=1), | intent(in) | :: | c |
the character |
s in lowercase (see lower_char).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | s |
the text |
Integer to string, without padding. Digits are built by hand: an internal write costs
far more, and this is called for every token by the safety check.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | i |
the number |
Number of characters (code points) in UTF-8 text: bytes that are not continuation bytes.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | text |
UTF-8 bytes |
Append str to the string, doubling the storage when it is full.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(string_builder_t), | intent(inout) | :: | self |
the builder |
||
| character(len=*), | intent(in) | :: | str |
the piece to append |
Turn s into lowercase in place, without a temporary copy (see lower_char).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(inout) | :: | s |
the text |