Inherited by macro.
Represents text as a sequence of ASCII code units. The derived type wraps an allocatable character array.
Initializes a new instance of the string class
type(string) function string(character(:) chars)
| [in] | chars |
Examples
The string implementation proposed here is kept at the bare minimum of what is required by the library. There are many other implementations that can be found.
Definition at line 107 of file string.f90.
Variables | |
| character(:), allocatable | chars |
| Variable length character array. | |
| generic, public assignment | ( | class(string), intent(inout) | lhs, |
| character(*), intent(in) | rhs ) |
Assignment overloading. Assign a character array to a string.
| [in,out] | lhs | string |
| [in] | rhs | character(*) |
Examples
Remarks
Definition at line 118 of file string.f90.
| generic, public assignment | ( | character(:), intent(inout), allocatable | lhs, |
| class(string), intent(in) | rhs ) |
Assignment overloading. Assign a string to a character array.
| [in,out] | lhs | character(:), allocatable |
| [in] | rhs | string |
Examples
Remarks
Definition at line 118 of file string.f90.
| public formatted | ( | class(string), intent(in) | dtv, |
| integer, intent(in) | unit, | ||
| character(*), intent(in) | iotype, | ||
| integer, dimension(:), intent(in) | v_list, | ||
| integer, intent(out) | iostat, | ||
| character(*), intent(inout) | iomsg ) |
Formatted output procedure for user-defined type string (UDTIO) This procedure is called automatically when a formatted WRITE statement is used with a variable of type string (when using the DT edit descriptor or default formatted output for the type).
It writes the content of the string component dtvchars using a simple A format. If the string is not allocated, an empty string is written.
| [in] | dtv | The string object to be written (polymorphic dummy argument) |
| [in] | unit | Fortran logical unit number |
| [in] | iotype | String describing the edit descriptor ('DT' + optional string) |
| [in] | v_list | Integer array containing the values from the DT edit descriptor (v_list is empty if no parentheses were used after DT) |
| [out] | iostat | I/O status code (0 = success, positive = error, negative = end-of-file/end-of-record) |
| [in,out] | iomsg | Message describing the I/O error (if any) |
Note
iotype and v_list parameters → the same simple character output is always performed(A)Warning This is a minimal implementation of UDTIO formatted output. More sophisticated versions could:
iotype (DT"..." or LISTDIRECTED)v_list for width/precision controlExamples
Remarks
Definition at line 123 of file string.f90.
Equality comparison between two string objects.
| [in] | lhs | left-hand side |
| [in] | rhs | right-hand side |
Remarks
Definition at line 120 of file string.f90.
| generic, public operator | ( | class(string), intent(in) | lhs, |
| character(*), intent(in) | rhs ) |
Equality comparison between string and character expression.
| [in] | lhs | string |
| [in] | rhs | character expression |
Remarks
Definition at line 120 of file string.f90.
| generic, public operator | ( | character(*), intent(in) | lhs, |
| class(string), intent(in) | rhs ) |
Equality comparison (reversed) between character expression and string.
| [in] | lhs | character expression |
| [in] | rhs | string |
Remarks
Definition at line 120 of file string.f90.
| generic, public write |
Definition at line 123 of file string.f90.