Miscellaneous string utilities.
Provides small helpers for formatting and manipulating allocatable strings and string arrays.
Simple amortized string accumulator.
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| type(string_t), | public, | allocatable | :: | a(:) | |||
| integer, | public | :: | n | = | 0 |
| procedure, public :: push => accum_push | |
| procedure, public :: to_array => accum_to_array |
Format a real number with two decimal places.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real, | intent(in) | :: | x |
Join a list of strings into a comma-separated value string.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(string_t), | intent(in), | allocatable | :: | a(:) | ||
| character(len=*), | intent(in) | :: | empty |
Trim an allocatable string or return a default if empty/unallocated.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=:), | intent(in), | allocatable | :: | s | ||
| character(len=*), | intent(in) | :: | default |
Trim an allocatable string or return an empty string if unallocated.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=:), | intent(in), | allocatable | :: | s |
Sort an array of strings and remove duplicates.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(string_t), | intent(inout), | allocatable | :: | a(:) |
Append a string to the accumulator (grows capacity as needed).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(string_accum_t), | intent(inout) | :: | self | |||
| character(len=*), | intent(in) | :: | s |
Materialize the accumulator into a right-sized array.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(string_accum_t), | intent(inout) | :: | self | |||
| type(string_t), | intent(out), | allocatable | :: | out(:) |