to_string Interface

public interface to_string

Converts an item to a string.


Contents


Module Procedures

private pure elemental function char_convert_to_string(x) result(rst)

Converts a Fortran character array to a string.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: x

The string to convert.

Return Value type(string)

The resulting string.

private pure elemental function int8_to_string(x) result(rst)

Converts an 8-bit integer to a string.

Arguments

Type IntentOptional Attributes Name
integer(kind=int8), intent(in) :: x

The value to convert.

Return Value type(string)

The resulting string.

private pure elemental function int16_to_string(x) result(rst)

Converts a 16-bit integer to a string.

Arguments

Type IntentOptional Attributes Name
integer(kind=int16), intent(in) :: x

The value to convert.

Return Value type(string)

The resulting string.

private pure elemental function int32_to_string(x) result(rst)

Converts a 32-bit integer to a string.

Arguments

Type IntentOptional Attributes Name
integer(kind=int32), intent(in) :: x

The value to convert.

Return Value type(string)

The resulting string.

private pure elemental function int64_to_string(x) result(rst)

Converts a 64-bit integer to a string.

Arguments

Type IntentOptional Attributes Name
integer(kind=int64), intent(in) :: x

The value to convert.

Return Value type(string)

The resulting string.

private pure elemental function real32_to_string(x, fmt) result(rst)

Converts a 32-bit real to a string.

Arguments

Type IntentOptional Attributes Name
real(kind=real32), intent(in) :: x

The value to convert.

character(len=*), intent(in), optional :: fmt

is used. If used, specify as "(G13.6)", or whatever appropriate format string is desired. Regardless, be sure to include the parenthesis.

Return Value type(string)

The resulting string.

private pure elemental function real64_to_string(x, fmt) result(rst)

Converts a 64-bit real to a string.

Arguments

Type IntentOptional Attributes Name
real(kind=real64), intent(in) :: x

The value to convert.

character(len=*), intent(in), optional :: fmt

is used. If used, specify as "(G13.6)", or whatever appropriate format string is desired. Regardless, be sure to include the parenthesis.

Return Value type(string)

The resulting string.

private pure elemental function real128_to_string(x, fmt) result(rst)

Converts a 128-bit real to a string.

Arguments

Type IntentOptional Attributes Name
real(kind=real128), intent(in) :: x

The value to convert.

character(len=*), intent(in), optional :: fmt

is used. If used, specify as "(G13.6)", or whatever appropriate format string is desired. Regardless, be sure to include the parenthesis.

Return Value type(string)

The resulting string.

private pure function c_string_to_string(str, nchar) result(rst)

Converts an array of C characters (C string) to a string. The C string must be null-terminated. The null-terimator character will not be included in the result.

Arguments

Type IntentOptional Attributes Name
character(kind=c_char, len=1), intent(in) :: str(*)

The C-string to convert.

integer(kind=int32), intent(in), optional :: nchar

conversion. The default is 2048.

Return Value type(string)