Text processing module
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
integer, | public, | parameter | :: | stdin | = | INPUT_UNIT | Standard input unit |
integer, | public, | parameter | :: | stdout | = | OUTPUT_UNIT | Standard output unit |
integer, | public, | parameter | :: | stderr | = | ERROR_UNIT | Standard error unit |
integer, | public, | parameter | :: | strLong | = | 128 | Length for long characters |
integer, | public, | parameter | :: | strShort | = | 32 | Length for short characters |
character(len=:), | public, | parameter | :: | fmtLong | = | '(1A128)' | Format for long characters |
character(len=:), | public, | parameter | :: | fmtShort | = | '(1A32)' | Format for short characters |
Remove all spaces from a string
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | s | String to remove spaces from |
String without spaces
Test if text starts with str
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | text | Text to search |
||
character(len=*), | intent(in) | :: | str | String to look for |
Test if text ends with str
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | text | Text to search |
||
character(len=*), | intent(in) | :: | str | String to look for |
Create a string from an integer
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | a | Integer value to convert |
||
character(len=*), | intent(in), | optional | :: | f | Format to use |
|
integer, | intent(in), | optional | :: | l | Final length of string |
Create a string from a real number
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=wp), | intent(in) | :: | a | Real value to convert |
||
character(len=*), | intent(in), | optional | :: | f | Format to use |
|
integer, | intent(in), | optional | :: | l | Final string length |
Convert a real number to a string
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=wp), | intent(in) | :: | a | Time span in seconds |
Convert a character into an array of character(1)
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | c | Character to convert |
New array of character(1)
Convert an array of character(1) into a character
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=1), | intent(in), | dimension(:) | :: | a | Array to convert |
New character
Bracket a string with text to change its color on a terminal
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | s | String to colorize |
||
integer, | intent(in), | dimension(3) | :: | c | Color to use in [r,g,b] format, where \(r,b,g \in [0,5]\) |
Return the color code for colorize based on the coolwarm color map
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=wp), | intent(in) | :: | v | Value to map |
||
real(kind=wp), | intent(in), | dimension(2) | :: | r | Range over which to scale the colors |
Create a progress bar through successive calls
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | m | Message to display |
||
real(kind=wp), | intent(in) | :: | p | Progress fraction \(p\in[0,1]\) |
||
integer, | intent(in), | optional | :: | ml | Message reserve length (used to align long messages) |