json_string_utilities Module

JSON-Fortran support module for string manipulation.

License

  • JSON-Fortran is released under a BSD-style license. See the LICENSE file for details.

Uses

  • module~~json_string_utilities~~UsesGraph module~json_string_utilities json_string_utilities module~json_kinds json_kinds module~json_string_utilities->module~json_kinds module~json_parameters json_parameters module~json_string_utilities->module~json_parameters iso_fortran_env iso_fortran_env module~json_kinds->iso_fortran_env module~json_parameters->module~json_kinds

Used by

  • module~~json_string_utilities~~UsedByGraph module~json_string_utilities json_string_utilities module~json_value_module json_value_module module~json_value_module->module~json_string_utilities module~json_file_module json_file_module module~json_file_module->module~json_string_utilities module~json_file_module->module~json_value_module module~json_module json_module module~json_module->module~json_value_module module~json_module->module~json_file_module

Contents


Interfaces

public interface to_unicode

Convert a 'DEFAULT' kind character input to 'ISO_10646' kind and return it

  • private pure function to_uni(str)

    Author
    Izaak Beekman

    Convert string to unicode (CDK to CK).

    Arguments

    Type IntentOptional AttributesName
    character(kind=CDK,len=*), intent(in) :: str

    Return Value character(kind=CK,len=len(str))

  • private pure function to_uni_vec(str)

    Author
    Izaak Beekman

    Convert array of strings to unicode (CDK to CK).

    Read more…

    Arguments

    Type IntentOptional AttributesName
    character(kind=CDK,len=*), intent(in), dimension(:):: str

    Return Value character(kind=CK,len=len(str)), dimension(size(str))


Functions

public pure function decode_rfc6901(str) result(str_out)

Decode a string from the "JSON Pointer" RFC 6901 format.

Read more…

Arguments

Type IntentOptional AttributesName
character(kind=CK,len=*), intent(in) :: str

Return Value character(kind=CK,len=:), allocatable

private pure elemental function default_comp_ucs4(def_str, ucs4_str) result(res)

Author
Izaak Beekman

CDK==CK operator.

Arguments

Type IntentOptional AttributesName
character(kind=CDK,len=*), intent(in) :: def_str
character(kind=CK,len=*), intent(in) :: ucs4_str

Return Value logical(kind=LK)

private pure function default_join_ucs4(def_str, ucs4_str) result(res)

Author
Izaak Beekman

CDK//CK operator.

Arguments

Type IntentOptional AttributesName
character(kind=CDK,len=*), intent(in) :: def_str
character(kind=CK,len=*), intent(in) :: ucs4_str

Return Value character(kind=CK,len=(len(def_str)+len(ucs4_str)))

private pure elemental function default_neq_ucs4(def_str, ucs4_str) result(res)

Author
Jacob Williams

CDK/=CK operator.

Arguments

Type IntentOptional AttributesName
character(kind=CDK,len=*), intent(in) :: def_str
character(kind=CK,len=*), intent(in) :: ucs4_str

Return Value logical(kind=LK)

public pure function encode_rfc6901(str) result(str_out)

Encode a string into the "JSON Pointer" RFC 6901 format.

Read more…

Arguments

Type IntentOptional AttributesName
character(kind=CK,len=*), intent(in) :: str

Return Value character(kind=CK,len=:), allocatable

public pure elemental function lowercase_string(str) result(s_lower)

Author
Jacob Williams

Returns lowercase version of the CK string.

Arguments

Type IntentOptional AttributesName
character(kind=CK,len=*), intent(in) :: str

input string

Return Value character(kind=CK,len=(len(str)))

lowercase version of the string

private pure function to_uni(str)

Author
Izaak Beekman

Convert string to unicode (CDK to CK).

Arguments

Type IntentOptional AttributesName
character(kind=CDK,len=*), intent(in) :: str

Return Value character(kind=CK,len=len(str))

private pure function to_uni_vec(str)

Author
Izaak Beekman

Convert array of strings to unicode (CDK to CK).

Read more…

Arguments

Type IntentOptional AttributesName
character(kind=CDK,len=*), intent(in), dimension(:):: str

Return Value character(kind=CK,len=len(str)), dimension(size(str))

private pure elemental function ucs4_comp_default(ucs4_str, def_str) result(res)

Author
Izaak Beekman

CK==CDK operator.

Arguments

Type IntentOptional AttributesName
character(kind=CK,len=*), intent(in) :: ucs4_str
character(kind=CDK,len=*), intent(in) :: def_str

Return Value logical(kind=LK)

private pure function ucs4_join_default(ucs4_str, def_str) result(res)

Author
Izaak Beekman

CK//CDK operator.

Arguments

Type IntentOptional AttributesName
character(kind=CK,len=*), intent(in) :: ucs4_str
character(kind=CDK,len=*), intent(in) :: def_str

Return Value character(kind=CK,len=(len(ucs4_str)+len(def_str)))

private pure elemental function ucs4_neq_default(ucs4_str, def_str) result(res)

Author
Jacob Williams

CK/=CDK operator.

Arguments

Type IntentOptional AttributesName
character(kind=CK,len=*), intent(in) :: ucs4_str
character(kind=CDK,len=*), intent(in) :: def_str

Return Value logical(kind=LK)

public pure function valid_json_hex(str) result(valid)

Author
Jacob Williams
Date
6/14/2014

Returns true if the string is a valid 4-digit hex string.

Read more…

Arguments

Type IntentOptional AttributesName
character(kind=CK,len=*), intent(in) :: str

the string to check.

Return Value logical(kind=LK)

is str a value 4-digit hex string


Subroutines

private subroutine compact_real_string(str)

Author
Izaak Beekman
Date
02/24/2015

Compact a string representing a real number, so that the same value is displayed with fewer characters.

Read more…

Arguments

Type IntentOptional AttributesName
character(kind=CK,len=*), intent(inout) :: str

string representation of a real number.

public subroutine escape_string(str_in, str_out, escape_solidus)

Author
Jacob Williams
Date
1/21/2014

Add the escape characters to a string for adding to JSON.

Arguments

Type IntentOptional AttributesName
character(kind=CK,len=*), intent(in) :: str_in
character(kind=CK,len=:), intent(out), allocatable:: str_out
logical(kind=LK), intent(in) :: escape_solidus

if the solidus (forward slash) is also to be escaped

public pure subroutine integer_to_string(ival, int_fmt, str)

Author
Jacob Williams
Date
12/4/2013

Convert an integer to a string.

Arguments

Type IntentOptional AttributesName
integer(kind=IK), intent(in) :: ival

integer value.

character(kind=CDK,len=*), intent(in) :: int_fmt

format for integers

character(kind=CK,len=*), intent(out) :: str

ival converted to a string.

public subroutine real_to_string(rval, real_fmt, compact_real, str)

Author
Jacob Williams
Date
12/4/2013

Convert a real value to a string.

Read more…

Arguments

Type IntentOptional AttributesName
real(kind=RK), intent(in) :: rval

real value.

character(kind=CDK,len=*), intent(in) :: real_fmt

format for real numbers

logical(kind=LK), intent(in) :: compact_real

compact the string so that it is displayed with fewer characters

character(kind=CK,len=*), intent(out) :: str

rval converted to a string.

public pure subroutine replace_string(str, s1, s2)

Replace all occurrences of s1 in str with s2.

Read more…

Arguments

Type IntentOptional AttributesName
character(kind=CK,len=:), intent(inout), allocatable:: str
character(kind=CK,len=*), intent(in) :: s1
character(kind=CK,len=*), intent(in) :: s2

public subroutine string_to_integer(str, ival, status_ok)

Convert a string into an integer.

Read more…

Arguments

Type IntentOptional AttributesName
character(kind=CK,len=*), intent(in) :: str

the string to convert to an integer

integer(kind=IK), intent(out) :: ival

the integer value

logical(kind=LK), intent(out) :: status_ok

true if there were no errors

public subroutine string_to_real(str, rval, status_ok)

Author
Jacob Williams
Date
1/19/2014

Convert a string into a real(RK).

Read more…

Arguments

Type IntentOptional AttributesName
character(kind=CK,len=*), intent(in) :: str

the string to convert to a real

real(kind=RK), intent(out) :: rval

str converted to a real value

logical(kind=LK), intent(out) :: status_ok

true if there were no errors

public subroutine unescape_string(str_in, str_out, error_message)

Remove the escape characters from a JSON string and return it.

Read more…

Arguments

Type IntentOptional AttributesName
character(kind=CK,len=*), intent(in) :: str_in

string as stored in a json_value

character(kind=CK,len=:), intent(out), allocatable:: str_out

decoded string

character(kind=CK,len=:), intent(out), allocatable:: error_message

will be allocated if there was an error