Handling character types. More...
Data Types | |
| interface | stoi |
| interface | stod |
| interface | get_array |
| interface | str_to_logical |
| interface | tochar |
| interface | roundnum |
| interface | concat |
| interface | stoa |
| interface | split |
| interface | index_ofs |
| interface | replace |
| interface | toupper |
| interface | tolower |
| interface | uchar |
| interface | lchar |
| interface | strieq |
| interface | strhead |
| interface | strinclude |
| interface | cprintf |
| interface | cprintft |
| interface | printf |
| interface | putline |
Functions/Subroutines | |
| character(string) function, public | joinchar (carray, expr) |
| integer function, public | index_ofs (string, start, substr) |
| recursive character(string) function, public | replace (str, from, to, recursive, start_pos) |
| character(string) function, public | uchar (ch) |
| character(string) function, public | lchar (ch) |
| character(string) function, public | roundnum (num) |
Handling character types.
Important
This file is generated from ../../../../src/dc_utils/dc_string.erb by ERB included Ruby 3.3.8. Please do not edit this file directly.
This module provides subroutines to handle character type variables.
| Procedure | Description |
|---|---|
| StoI | Convert string to integer |
| StoD | Convert string to double precision real |
| get_array | Parse comma-separated string to array pointer |
| Str_to_Logical | Convert string to logical |
| toChar | Convert numeric/logical to string |
| RoundNum | Round numeric string representation |
| JoinChar | Join character array with delimiter |
| Concat | Concatenate string to array elements |
| StoA | Convert multiple strings to array |
| Split | Split string by separator |
| Index_Ofs | Find substring position with offset |
| Replace | Replace substring in string |
| toUpper | Convert string to uppercase (in-place) |
| toLower | Convert string to lowercase (in-place) |
| UChar | Return uppercase copy of string |
| LChar | Return lowercase copy of string |
| StriEq | Case-insensitive string comparison |
| StrHead | Check if string starts with prefix |
| StrInclude | Check if array contains string |
| CPrintf | C-style printf returning string |
| Printf | C-style printf to unit or string |
| PutLine | Print array summary (size, max, min, avg) |
| integer function, public dc_string::index_ofs | ( | character(len = *), intent(in) | string, |
| integer, intent(in) | start, | ||
| character(len = *), intent(in) | substr ) |
Find substring position with offset
Returns the starting position where substr is found in string, searching from position start. Returns 0 if not found. The returned position is counted from the beginning of string.
| [in] | string | String to search in |
| [in] | start | Starting position for search |
| [in] | substr | Substring to find |
Definition at line 1611 of file dc_string.f90.
| character(string) function, public dc_string::joinchar | ( | character(*), dimension(:), intent(in) | carray, |
| character(*), intent(in), optional | expr ) |
Join character array with delimiter
Joins elements of character array carray with ", " delimiter. If expr is given, uses that string as delimiter.
| [in] | carray | Character array to join |
| [in] | expr | Delimiter string (optional, default: ", ") |
Definition at line 1120 of file dc_string.f90.
| character(string) function, public dc_string::lchar | ( | character(len = *), intent(in) | ch | ) |
Return lowercase copy of string
Returns a copy of ch with all uppercase letters converted to lowercase. Non-alphabetic characters and already lowercase characters are unchanged.
| [in] | ch | String to convert |
Definition at line 1808 of file dc_string.f90.
| recursive character(string) function, public dc_string::replace | ( | character(*), intent(in) | str, |
| character(*), intent(in) | from, | ||
| character(*), intent(in) | to, | ||
| logical, intent(in), optional | recursive, | ||
| integer, intent(in), optional | start_pos ) |
Replace substring in string
If string from is included in str, replaces it with string to and returns. If from is not included, returns str without change. When multiple from are included, only the first one is replaced. To replace all from to to, give .true. to optional argument recursive. By default, the string is searched from the top. If optional argument start_pos is given, the search starts from start_pos.
| [in] | str | Source string |
| [in] | from | String to find |
| [in] | to | Replacement string |
| [in] | recursive | If .true., replace all occurrences (optional) |
| [in] | start_pos | Starting position for search (optional) |
Definition at line 1658 of file dc_string.f90.
| character(string) function, public dc_string::roundnum | ( | character(*), intent(in) | num | ) |
Round numeric string representation
Formats numeric strings like '0.30000001' or '12.999998' that have rounding errors to cleaner representations like '0.3' or '13.'.
| [in] | num | Numeric string to round |
Definition at line 1831 of file dc_string.f90.
| character(string) function, public dc_string::uchar | ( | character(len = *), intent(in) | ch | ) |
Return uppercase copy of string
Returns a copy of ch with all lowercase letters converted to uppercase. Non-alphabetic characters and already uppercase characters are unchanged.
| [in] | ch | String to convert |
Definition at line 1785 of file dc_string.f90.