A growable string type for advanced character handling and text I/O.
For a user reference, see String, String methods, and Operators.
Note
TECHNICAL NOTE: The String
type is memory safe. The user will never need to be concerned about
accessing invalid memory when using the String
type. Any operation defined in this documentation for the
String
type which may involve a String
with an unallocated component, or arrays of String
s in which
some of the elements may have unallocated components, is well-defined. In all such cases, the component is
treated as the empty string.
Function for returning a String representation of numbers.
For a user reference, see String, String methods, and Operators.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
complex(kind=r128), | intent(in) | :: | x | |||
character(len=*), | intent(in), | optional | :: | locale | ||
character(len=*), | intent(in), | optional | :: | fmt | ||
integer, | intent(in), | optional | :: | decimals | ||
character(len=*), | intent(in), | optional | :: | im |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
complex(kind=r64), | intent(in) | :: | x | |||
character(len=*), | intent(in), | optional | :: | locale | ||
character(len=*), | intent(in), | optional | :: | fmt | ||
integer, | intent(in), | optional | :: | decimals | ||
character(len=*), | intent(in), | optional | :: | im |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
complex(kind=r32), | intent(in) | :: | x | |||
character(len=*), | intent(in), | optional | :: | locale | ||
character(len=*), | intent(in), | optional | :: | fmt | ||
integer, | intent(in), | optional | :: | decimals | ||
character(len=*), | intent(in), | optional | :: | im |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=r128), | intent(in) | :: | x | |||
character(len=*), | intent(in), | optional | :: | locale | ||
character(len=*), | intent(in), | optional | :: | fmt | ||
integer, | intent(in), | optional | :: | decimals |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=r64), | intent(in) | :: | x | |||
character(len=*), | intent(in), | optional | :: | locale | ||
character(len=*), | intent(in), | optional | :: | fmt | ||
integer, | intent(in), | optional | :: | decimals |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=r32), | intent(in) | :: | x | |||
character(len=*), | intent(in), | optional | :: | locale | ||
character(len=*), | intent(in), | optional | :: | fmt | ||
integer, | intent(in), | optional | :: | decimals |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=i64), | intent(in) | :: | x | |||
character(len=*), | intent(in), | optional | :: | fmt |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=i32), | intent(in) | :: | x | |||
character(len=*), | intent(in), | optional | :: | fmt |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=i16), | intent(in) | :: | x | |||
character(len=*), | intent(in), | optional | :: | fmt |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=i8), | intent(in) | :: | x | |||
character(len=*), | intent(in), | optional | :: | fmt |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(String), | intent(in) | :: | x |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | x |
Methods for the String
type.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(String), | intent(in) | :: | substring | |||
complex(kind=r128), | intent(out) | :: | into | |||
character(len=*), | intent(in), | optional | :: | locale | ||
character(len=*), | intent(in), | optional | :: | fmt | ||
character(len=*), | intent(in), | optional | :: | im |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(String), | intent(in) | :: | substring | |||
complex(kind=r64), | intent(out) | :: | into | |||
character(len=*), | intent(in), | optional | :: | locale | ||
character(len=*), | intent(in), | optional | :: | fmt | ||
character(len=*), | intent(in), | optional | :: | im |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(String), | intent(in) | :: | substring | |||
complex(kind=r32), | intent(out) | :: | into | |||
character(len=*), | intent(in), | optional | :: | locale | ||
character(len=*), | intent(in), | optional | :: | fmt | ||
character(len=*), | intent(in), | optional | :: | im |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(String), | intent(in) | :: | substring | |||
real(kind=r128), | intent(out) | :: | into | |||
character(len=*), | intent(in), | optional | :: | locale | ||
character(len=*), | intent(in), | optional | :: | fmt |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(String), | intent(in) | :: | substring | |||
real(kind=r64), | intent(out) | :: | into | |||
character(len=*), | intent(in), | optional | :: | locale | ||
character(len=*), | intent(in), | optional | :: | fmt |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(String), | intent(in) | :: | substring | |||
real(kind=r32), | intent(out) | :: | into | |||
character(len=*), | intent(in), | optional | :: | locale | ||
character(len=*), | intent(in), | optional | :: | fmt |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(String), | intent(in) | :: | substring | |||
integer(kind=i64), | intent(out) | :: | into | |||
character(len=*), | intent(in), | optional | :: | fmt |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(String), | intent(in) | :: | substring | |||
integer(kind=i32), | intent(out) | :: | into | |||
character(len=*), | intent(in), | optional | :: | fmt |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(String), | intent(in) | :: | substring | |||
integer(kind=i16), | intent(out) | :: | into | |||
character(len=*), | intent(in), | optional | :: | fmt |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(String), | intent(in) | :: | substring | |||
integer(kind=i8), | intent(out) | :: | into | |||
character(len=*), | intent(in), | optional | :: | fmt |
Methods for the String
type.
Methods for the String
type.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(String), | intent(in) | :: | substring | |||
character(len=*), | intent(in) | :: | file | |||
logical, | intent(in), | optional, | target | :: | append | |
character(len=*), | intent(in), | optional, | target | :: | terminator | |
integer, | intent(out), | optional, | target | :: | stat | |
character(len=*), | intent(out), | optional, | target | :: | errmsg |
Methods for the String
type.
Methods for the String
type.
Methods for the String
type.
Methods for the String
type.
Methods for the String
type.
Methods for the String
type.
Methods for the String
type.
Methods for the String
type.
Methods for the String
type.
Methods for the String
type.
Methods for the String
type.
Methods for the String
type.
Returns a copy of the string slice component of a scalar String
.
For a user reference, see as_str.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(String), | intent(in) | :: | self |
Methods for the String
type.
Sets the string slice component to the empty string elementally. This procedure is identical in function
to the assignment self = String()
.
For a user reference, see empty.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(String), | intent(inout) | :: | self |
Methods for the String
type.
Joins a String
vector tokens
into self
with given separator. Default separator is SPACE. The
string slice component will be replaced if already allocated.
For a user reference, see join.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(String), | intent(inout) | :: | self | |||
type(String), | intent(in) | :: | tokens(:) | |||
character(len=*), | intent(in), | optional | :: | separator |
Methods for the String
type.
Returns the length of the string slice component elementally. Unallocated components return -1
.
For a user reference, see len.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(String), | intent(in) | :: | self |
Methods for the String
type.
Returns the length of the string slice component elementally. Unallocated components return -1
. This
function is identical to len
for strings of 2,147,483,647 bytes or smaller.
For a user reference, see len.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(String), | intent(in) | :: | self |
Methods for the String
type.
Reads raw text file contents into self
and optionally populates a cell array using the designated
row_separator
and column_separator
whose default values are LF
and COMMA
respectively.
For a user reference, see read_file.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(String), | intent(inout) | :: | self | |||
character(len=*), | intent(in) | :: | file | |||
type(String), | intent(out), | optional, | allocatable | :: | cell_array(:,:) | |
character(len=*), | intent(in), | optional, | target | :: | row_separator | |
character(len=*), | intent(in), | optional, | target | :: | column_separator | |
integer, | intent(out), | optional, | target | :: | stat | |
character(len=*), | intent(out), | optional, | target | :: | errmsg |
Methods for the String
type.
Returns a copy of a String
elementally in which each string slice component has been trimmed of any
leading or trailing whitespace.
For a user reference, see trim.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(String), | intent(in) | :: | self |
Methods for the String
type.
Removes any leading or trailing whitespace of the string slice component of a String
elementally and
in place.
For a user reference, see trim_inplace.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(String), | intent(inout) | :: | self |
Methods for the String
type.
Writes the content of a cell array to a text file. The cell array's entire contents are populated into
self
and then streamed to an external text file using the designated row_separator
and
column_separator
whose default values are LF
and COMMA
respectively.
For a user reference, see write_file.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(String), | intent(inout) | :: | self | |||
type(String), | intent(in) | :: | cell_array(:,:) | |||
character(len=*), | intent(in) | :: | file | |||
character(len=*), | intent(in), | optional, | target | :: | row_separator | |
character(len=*), | intent(in), | optional, | target | :: | column_separator | |
logical, | intent(in), | optional, | target | :: | append | |
integer, | intent(out), | optional, | target | :: | stat | |
character(len=*), | intent(out), | optional, | target | :: | errmsg |