![]() |
libSUFR
a LIBrary of Some Useful Fortran Routines
|
Procedures to manipulate text/strings. More...
Functions/Subroutines | |
| pure character function, dimension(len(str)) | lowercase (str) |
| Make a string lower case. | |
| pure character function, dimension(len(str)) | uppercase (str) |
| Make a string upper case. | |
| pure character function, dimension(len(str)) | uppercaseinitial (str) |
| Make a string lower case with an upper-case initial. | |
| pure character function, dimension((len(str16)+1)/2) | utf16to8 (str16) |
| Convert a UTF-16 string to UTF-8. | |
| pure subroutine | replace_substring (string, str_srch, str_repl) |
| Search and replace occurences of a substring in a string as often as the search string is found. | |
| subroutine | remove_substring (string, substr, debug) |
| Remove a substring from a string, if present. | |
| integer function | count_substring (string, substr) |
| Count how many times a substring is present in a string. | |
| subroutine | replace_string_in_textfile (file_in, file_out, str_srch, str_repl, status) |
| Search and replace occurences of a string in a text file. Lines up to 9999 characters only, otherwise a warning is given. | |
| pure logical function | string_contains_one_of (string, characters) |
| Verify whether a string contains any of a given list of characters. | |
| pure character function, dimension(max(number, 1)) | tabs (number) |
| Print multiple tab characters. | |
| pure character function, dimension(sign(1, number) -1) | int2str (number) |
| Convert an integer to a character string of the proper length. | |
| pure character function, dimension(sign(1_long, floor(number, long)) -1) | dbl2str (number, decim, mark) |
| Convert a double-precision real to a nice character string. Difference with the F0 format descriptor: replace leading . or -. with 0. and -0. respectively (0.1 iso .1; -0.1 iso -.1). | |
| pure character function, dimension(sign(1_long, floor(number, long)) -1) | d2s (number, decim, mark) |
| Convert a double-precision real to a nice character string. Short alias for dbl2str(). | |
| pure character function, dimension(sign(1_long, floor(number, long)) -1) | d2sc (number, decim) |
| Convert a double-precision real to a nice character string using a comma as decimal mark. Alias for dbl2str(number, decim, ','). | |
| pure character function, dimension(sign(1, floor(number)) -1) | real2str (number, decim, mark) |
| Convert a single-precision real to a nice character string. Single-precision wrapper for dbl2str. | |
Procedures to manipulate text/strings.
| integer function sufr_text::count_substring | ( | character, dimension(*), intent(in) | string, |
| character, dimension(*), intent(in) | substr ) |
Count how many times a substring is present in a string.
| string | String to count substrings in. |
| substr | Substring to count. |
| count | Number of times substring was found in string. |
Definition at line 270 of file text.f90.
References count_substring().
Referenced by count_substring(), and sufr_getopt::getopt_get_command().

| pure character function, dimension (sign(1_long,floor(number,long))-1) sufr_text::d2s | ( | real(double), intent(in) | number, |
| character, intent(in) | decim, | ||
| character, dimension(*), intent(in), optional | mark ) |
Convert a double-precision real to a nice character string. Short alias for dbl2str().
| number | Value to convert |
| decim | Number of decimals to use |
| mark | Decimal mark to separate the integer and fractional parts; single character, e.g. "," (optional; default: ".") |
| d2s | String containing the double |
Definition at line 519 of file text.f90.
References d2s(), dbl2str(), sufr_kinds::double, and sufr_kinds::long.
Referenced by d2s().

| pure character function, dimension (sign(1_long,floor(number,long))-1) sufr_text::d2sc | ( | real(double), intent(in) | number, |
| character, intent(in) | decim ) |
Convert a double-precision real to a nice character string using a comma as decimal mark. Alias for dbl2str(number, decim, ',').
| number | Value to convert |
| decim | Number of decimals to use |
| d2sc | String containing the double |
Definition at line 548 of file text.f90.
References d2sc(), dbl2str(), sufr_kinds::double, and sufr_kinds::long.
Referenced by d2sc().

| pure character function, dimension (sign(1_long,floor(number,long))-1) sufr_text::dbl2str | ( | real(double), intent(in) | number, |
| character, intent(in) | decim, | ||
| character, dimension(*), intent(in), optional | mark ) |
Convert a double-precision real to a nice character string. Difference with the F0 format descriptor: replace leading . or -. with 0. and -0. respectively (0.1 iso .1; -0.1 iso -.1).
| number | Value to convert |
| decim | Number of decimals to use |
| mark | Decimal mark to separate the integer and fractional parts; single character, e.g. "," (optional; default: ".") |
| dbl2str | String containing the double |
Definition at line 454 of file text.f90.
References dbl2str(), sufr_kinds::double, sufr_kinds::long, and replace_substring().
Referenced by d2s(), d2sc(), dbl2str(), sufr_getopt::getopt_optarg_to_dbl(), and real2str().

| pure character function, dimension (sign(1,number)-1) sufr_text::int2str | ( | integer, intent(in) | number | ) |
Convert an integer to a character string of the proper length.
| number | Integer number to convert |
| int2str | Character string |
Definition at line 434 of file text.f90.
References int2str().
Referenced by sufr_getopt::getopt_get_command_argument(), sufr_getopt::getopt_optarg_to_int(), and int2str().

| pure character function, dimension(len(str)) sufr_text::lowercase | ( | character, dimension(*), intent(in) | str | ) |
Make a string lower case.
| str | String |
| lowercase | String as lower case |
Definition at line 34 of file text.f90.
References lowercase().
Referenced by lowercase().

| pure character function, dimension (sign(1,floor(number))-1) sufr_text::real2str | ( | real, intent(in) | number, |
| character, intent(in) | decim, | ||
| character, dimension(*), intent(in), optional | mark ) |
Convert a single-precision real to a nice character string. Single-precision wrapper for dbl2str.
| number | Value to convert |
| decim | Number of decimals to use |
| mark | Decimal mark to separate the integer and fractional parts; single character, e.g. "," (optional; default: ".") |
| real2str | String containing the real |
Definition at line 572 of file text.f90.
References dbl2str(), and real2str().
Referenced by sufr_getopt::getopt_optarg_to_real(), and real2str().

| subroutine sufr_text::remove_substring | ( | character, dimension(*), intent(inout) | string, |
| character, dimension(*), intent(in) | substr, | ||
| logical, intent(in), optional | debug ) |
Remove a substring from a string, if present.
| string | String to remove the substring from. Trailing spaces are retained, call with string(1:len_trim(string)) to ignore them and speed things up. |
| substr | Substring to remove |
| debug | Print debug info (T/F, optional) |
Definition at line 221 of file text.f90.
Referenced by sufr_text_html::remove_html_bold_italics(), and sufr_text_html::remove_html_links().
| subroutine sufr_text::replace_string_in_textfile | ( | character, dimension(*), intent(in) | file_in, |
| character, dimension(*), intent(in) | file_out, | ||
| character, dimension(*), intent(in) | str_srch, | ||
| character, dimension(*), intent(in) | str_repl, | ||
| integer, intent(out) | status ) |
Search and replace occurences of a string in a text file. Lines up to 9999 characters only, otherwise a warning is given.
| file_in | Name of the text file to replace in |
| file_out | Name of the text file to store the result in |
| str_srch | Search string |
| str_repl | Replacement string |
| status | Exit status: 0-ok, 1/2: could not open I/O file, 11/12: character array string too small (output) |
Definition at line 313 of file text.f90.
References sufr_system::error(), sufr_system::find_free_io_unit(), and replace_substring().

| pure subroutine sufr_text::replace_substring | ( | character, dimension(*), intent(inout) | string, |
| character, dimension(*), intent(in) | str_srch, | ||
| character, dimension(*), intent(in) | str_repl ) |
Search and replace occurences of a substring in a string as often as the search string is found.
| string | Original string to replace in. Trailing spaces are retained, call with string(1:len_trim(string)) to ignore them and speed things up. |
| str_srch | Search string |
| str_repl | Replacement string |
Definition at line 143 of file text.f90.
Referenced by dbl2str(), sufr_text_html::remove_html_br_p_hr(), and replace_string_in_textfile().
| pure logical function sufr_text::string_contains_one_of | ( | character, dimension(*), intent(in) | string, |
| character, dimension(*), intent(in) | characters ) |
Verify whether a string contains any of a given list of characters.
| string | String to verify |
| characters | List of characters |
| string_contains_one_of | True if the string contains one of the specified characters, otherwise false |
Definition at line 383 of file text.f90.
References string_contains_one_of().
Referenced by string_contains_one_of().

| pure character function, dimension(max(number,1)) sufr_text::tabs | ( | integer, intent(in) | number | ) |
| pure character function, dimension(len(str)) sufr_text::uppercase | ( | character, dimension(*), intent(in) | str | ) |
Make a string upper case.
| str | String |
| uppercase | String as uppercase |
Definition at line 58 of file text.f90.
References uppercase().
Referenced by uppercase().

| pure character function, dimension(len(str)) sufr_text::uppercaseinitial | ( | character, dimension(*), intent(in) | str | ) |
Make a string lower case with an upper-case initial.
| str | String |
| uppercaseinitial | String in lower case, with upper-case initial |
Definition at line 82 of file text.f90.
References uppercaseinitial().
Referenced by uppercaseinitial().

| pure character function, dimension((len(str16)+1)/2) sufr_text::utf16to8 | ( | character, dimension(*), intent(in) | str16 | ) |
Convert a UTF-16 string to UTF-8.
| str16 | UTF-16 string |
| UTF16to8 | UTF-8 string (about half the length of str16) |
Definition at line 111 of file text.f90.
References utf16to8(), and sufr_system::warn().
Referenced by utf16to8().
