dm_string Module

String utility routines.


Uses

  • module~~dm_string~~UsesGraph module~dm_string dm_string module~dm_error dm_error module~dm_string->module~dm_error module~dm_kind dm_kind module~dm_string->module~dm_kind module~dm_error->module~dm_kind module~dm_ascii dm_ascii module~dm_error->module~dm_ascii iso_fortran_env iso_fortran_env module~dm_kind->iso_fortran_env

Used by

  • module~~dm_string~~UsedByGraph module~dm_string dm_string module~dm_camera dm_camera module~dm_camera->module~dm_string module~dm_cgi dm_cgi module~dm_cgi->module~dm_string module~dm_config dm_config module~dm_config->module~dm_string module~dm_lua dm_lua module~dm_config->module~dm_lua module~dm_crypto dm_crypto module~dm_crypto->module~dm_string module~dm_csv dm_csv module~dm_csv->module~dm_string module~dm_db dm_db module~dm_db->module~dm_string module~dm_env dm_env module~dm_env->module~dm_string module~dm_html dm_html module~dm_html->module~dm_string module~dm_lua->module~dm_string module~dm_plot dm_plot module~dm_plot->module~dm_string module~dm_request dm_request module~dm_request->module~dm_string module~dm_sync dm_sync module~dm_sync->module~dm_string module~dm_observ dm_observ module~dm_sync->module~dm_observ module~dm_tty dm_tty module~dm_tty->module~dm_string module~dmpack dmpack module~dmpack->module~dm_string module~dmpack->module~dm_camera module~dmpack->module~dm_cgi module~dmpack->module~dm_config module~dmpack->module~dm_crypto module~dmpack->module~dm_csv module~dmpack->module~dm_db module~dmpack->module~dm_env module~dmpack->module~dm_html module~dmpack->module~dm_lua module~dmpack->module~dm_plot module~dmpack->module~dm_request module~dmpack->module~dm_sync module~dmpack->module~dm_tty module~dm_atom dm_atom module~dmpack->module~dm_atom module~dm_cgi_router dm_cgi_router module~dmpack->module~dm_cgi_router module~dm_fcgi dm_fcgi module~dmpack->module~dm_fcgi module~dm_geocom dm_geocom module~dmpack->module~dm_geocom module~dm_geocom_api dm_geocom_api module~dmpack->module~dm_geocom_api module~dm_lua_api dm_lua_api module~dmpack->module~dm_lua_api module~dm_lua_geocom dm_lua_geocom module~dmpack->module~dm_lua_geocom module~dmpack->module~dm_observ module~dm_report dm_report module~dmpack->module~dm_report module~dm_job dm_job module~dmpack->module~dm_job module~dm_log dm_log module~dmpack->module~dm_log module~dm_logger dm_logger module~dmpack->module~dm_logger module~dm_mqueue dm_mqueue module~dmpack->module~dm_mqueue module~dm_mqueue_util dm_mqueue_util module~dmpack->module~dm_mqueue_util proc~dm_api_status_from_string dm_api_status_from_string proc~dm_api_status_from_string->module~dm_string proc~dm_arg_validate dm_arg_validate proc~dm_arg_validate->module~dm_string proc~dm_arg_validate->module~dm_log proc~dm_beat_is_valid dm_beat_is_valid proc~dm_beat_is_valid->module~dm_string proc~dm_format_from_name dm_format_from_name proc~dm_format_from_name->module~dm_string proc~dm_im_send_presence dm_im_send_presence proc~dm_im_send_presence->module~dm_string proc~dm_log_is_valid dm_log_is_valid proc~dm_log_is_valid->module~dm_string proc~dm_log_level_from_name dm_log_level_from_name proc~dm_log_level_from_name->module~dm_string proc~dm_log_level_from_string dm_log_level_from_string proc~dm_log_level_from_string->module~dm_string proc~dm_modbus_byte_order_from_name dm_modbus_byte_order_from_name proc~dm_modbus_byte_order_from_name->module~dm_string proc~dm_regex_request dm_regex_request proc~dm_regex_request->module~dm_string proc~dm_regex_request->module~dm_request proc~dm_sensor_type_from_name dm_sensor_type_from_name proc~dm_sensor_type_from_name->module~dm_string proc~dm_type_from_name dm_type_from_name proc~dm_type_from_name->module~dm_string proc~dm_z_compress_types dm_z_compress_types proc~dm_z_compress_types->module~dm_string proc~dm_z_type_from_name dm_z_type_from_name proc~dm_z_type_from_name->module~dm_string module~dm_atom->module~dm_html module~dm_atom->module~dm_log module~dm_cgi_router->module~dm_cgi module~dm_fcgi->module~dm_cgi module~dm_geocom->module~dm_request module~dm_geocom->module~dm_tty module~dm_geocom->module~dm_geocom_api module~dm_geocom_api->module~dm_request module~dm_lua_api->module~dm_lua module~dm_lua_geocom->module~dm_lua module~dm_lua_geocom->module~dm_request module~dm_lua_geocom->module~dm_geocom_api module~dm_observ->module~dm_request module~dm_report->module~dm_plot module~dm_report->module~dm_log proc~dm_csv_header_observ dm_csv_header_observ proc~dm_csv_header_observ->module~dm_request proc~dm_csv_header_observ->module~dm_observ proc~dm_db_insert_sync dm_db_insert_sync proc~dm_db_insert_sync->module~dm_sync proc~dm_db_insert_sync_log dm_db_insert_sync_log proc~dm_db_insert_sync_log->module~dm_sync proc~dm_db_insert_sync_node dm_db_insert_sync_node proc~dm_db_insert_sync_node->module~dm_sync proc~dm_db_insert_sync_observ dm_db_insert_sync_observ proc~dm_db_insert_sync_observ->module~dm_sync proc~dm_db_insert_sync_sensor dm_db_insert_sync_sensor proc~dm_db_insert_sync_sensor->module~dm_sync proc~dm_db_insert_sync_target dm_db_insert_sync_target proc~dm_db_insert_sync_target->module~dm_sync proc~dm_db_select_sync_log dm_db_select_sync_log proc~dm_db_select_sync_log->module~dm_sync proc~dm_db_select_sync_logs dm_db_select_sync_logs proc~dm_db_select_sync_logs->module~dm_sync proc~dm_db_select_sync_node dm_db_select_sync_node proc~dm_db_select_sync_node->module~dm_sync proc~dm_db_select_sync_nodes dm_db_select_sync_nodes proc~dm_db_select_sync_nodes->module~dm_sync proc~dm_db_select_sync_observ dm_db_select_sync_observ proc~dm_db_select_sync_observ->module~dm_sync proc~dm_db_select_sync_observs dm_db_select_sync_observs proc~dm_db_select_sync_observs->module~dm_sync proc~dm_db_select_sync_sensor dm_db_select_sync_sensor proc~dm_db_select_sync_sensor->module~dm_sync proc~dm_db_select_sync_sensors dm_db_select_sync_sensors proc~dm_db_select_sync_sensors->module~dm_sync proc~dm_db_select_sync_target dm_db_select_sync_target proc~dm_db_select_sync_target->module~dm_sync proc~dm_db_select_sync_targets dm_db_select_sync_targets proc~dm_db_select_sync_targets->module~dm_sync proc~dm_html_cgi_env dm_html_cgi_env proc~dm_html_cgi_env->module~dm_cgi proc~dm_html_request dm_html_request proc~dm_html_request->module~dm_request proc~dm_modbus_create_rtu dm_modbus_create_rtu proc~dm_modbus_create_rtu->module~dm_tty proc~dm_regex_response_string dm_regex_response_string proc~dm_regex_response_string->module~dm_request proc~dm_test_dummy_observ dm_test_dummy_observ proc~dm_test_dummy_observ->module~dm_request proc~dm_test_dummy_observ->module~dm_observ proc~dm_test_dummy_request dm_test_dummy_request proc~dm_test_dummy_request->module~dm_request proc~dm_test_skip dm_test_skip proc~dm_test_skip->module~dm_env proc~dm_tty_read_request dm_tty_read_request proc~dm_tty_read_request->module~dm_request proc~dm_tty_write_request dm_tty_write_request proc~dm_tty_write_request->module~dm_request proc~luaopen_libdmpack luaopen_libdmpack proc~luaopen_libdmpack->module~dm_lua proc~luaopen_libdmpack->module~dm_lua_api proc~luaopen_libdmpack->module~dm_lua_geocom module~dm_job->module~dm_observ module~dm_log->module~dm_observ module~dm_logger->module~dm_observ module~dm_logger->module~dm_log module~dm_mqueue->module~dm_observ module~dm_mqueue->module~dm_log proc~dm_config_open dm_config_open proc~dm_config_open->module~dm_lua_api proc~dm_config_open->module~dm_lua_geocom proc~dm_db_insert_observ dm_db_insert_observ proc~dm_db_insert_observ->module~dm_observ proc~dm_db_insert_observs dm_db_insert_observs proc~dm_db_insert_observs->module~dm_observ proc~dm_db_select_observ dm_db_select_observ proc~dm_db_select_observ->module~dm_observ proc~dm_db_select_observ_ids dm_db_select_observ_ids proc~dm_db_select_observ_ids->module~dm_observ proc~dm_db_select_observ_views dm_db_select_observ_views proc~dm_db_select_observ_views->module~dm_observ proc~dm_db_select_observs_by_id dm_db_select_observs_by_id proc~dm_db_select_observs_by_id->module~dm_observ proc~dm_db_select_observs_by_time dm_db_select_observs_by_time proc~dm_db_select_observs_by_time->module~dm_observ proc~dm_html_observ dm_html_observ proc~dm_html_observ->module~dm_observ proc~dm_html_observs dm_html_observs proc~dm_html_observs->module~dm_observ proc~dm_z_compress_type dm_z_compress_type proc~dm_z_compress_type->module~dm_observ proc~dm_z_compress_type->module~dm_log module~dm_mqueue_util->module~dm_mqueue proc~dm_db_insert_log dm_db_insert_log proc~dm_db_insert_log->module~dm_log proc~dm_db_select_log dm_db_select_log proc~dm_db_select_log->module~dm_log proc~dm_db_select_logs_by_observ dm_db_select_logs_by_observ proc~dm_db_select_logs_by_observ->module~dm_log proc~dm_html_log dm_html_log proc~dm_html_log->module~dm_log proc~dm_html_logs dm_html_logs proc~dm_html_logs->module~dm_log proc~dm_lua_api_register dm_lua_api_register proc~dm_lua_api_register->module~dm_log proc~dm_test_dummy_log dm_test_dummy_log proc~dm_test_dummy_log->module~dm_log

Interfaces

public interface dm_lower

Alias for procedure.

  • public pure elemental subroutine dm_string_lower(str)

    Converts given string to lower case.

    Arguments

    Type IntentOptional Attributes Name
    character(len=*), intent(inout) :: str

    Input/output string.

public interface dm_upper

Alias for procedure.

  • public pure elemental subroutine dm_string_upper(str)

    Converts given string to upper case.

    Arguments

    Type IntentOptional Attributes Name
    character(len=*), intent(inout) :: str

    Input/output string.

public interface dm_to_lower

Alias for procedure.

  • public pure elemental function dm_string_to_lower(str) result(lower)

    Returns given string in lower case.

    Arguments

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

    String to convert.

    Return Value character(len=len)

    Result.

public interface dm_to_upper

Alias for procedure.

  • public pure elemental function dm_string_to_upper(str) result(upper)

    Returns given string in upper case.

    Arguments

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

    String to convert.

    Return Value character(len=len)

    Result.

public interface dm_string_from

Generic number to string converter.

  • private pure subroutine string_from_int32(i, str, error)

    Returns string representation of given 4-byte integer.

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=i4), intent(in) :: i

    Input.

    character(len=:), intent(out), allocatable :: str

    Output.

    integer, intent(out), optional :: error

    Error code.

  • private pure subroutine string_from_int64(i, str, error)

    Returns string representation of given 8-byte integer.

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=i8), intent(in) :: i

    Input.

    character(len=:), intent(out), allocatable :: str

    Output.

    integer, intent(out), optional :: error

    Error code.

  • private pure subroutine string_from_real32(f, str, error)

    Returns string representation of given 4-byte real.

    Arguments

    Type IntentOptional Attributes Name
    real(kind=r4), intent(in) :: f

    Input.

    character(len=:), intent(out), allocatable :: str

    Output.

    integer, intent(out), optional :: error

    Error code.

  • private pure subroutine string_from_real64(f, str, error)

    Returns string representation of given 8-byte real.

    Arguments

    Type IntentOptional Attributes Name
    real(kind=r8), intent(in) :: f

    Input.

    character(len=:), intent(out), allocatable :: str

    Output.

    integer, intent(out), optional :: error

    Error code.

public interface dm_string_to

Generic string to number converter.

  • private pure elemental subroutine string_to_int32(str, i, error)

    Converts string to 4-byte integer.

    Arguments

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

    Input.

    integer(kind=i4), intent(out) :: i

    Output.

    integer, intent(out), optional :: error

    Error code.

  • private pure elemental subroutine string_to_int64(str, i, error)

    Converts string to 8-byte integer.

    Arguments

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

    Input.

    integer(kind=i8), intent(out) :: i

    Output.

    integer, intent(out), optional :: error

    Error code.

  • private pure elemental subroutine string_to_real32(str, f, error)

    Converts string to 4-byte real.

    Arguments

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

    Input.

    real(kind=r4), intent(out) :: f

    Output.

    integer, intent(out), optional :: error

    Error code.

  • private pure elemental subroutine string_to_real64(str, f, error)

    Converts string to 8-byte real.

    Arguments

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

    Input.

    real(kind=r8), intent(out) :: f

    Output.

    integer, intent(out), optional :: error

    Error code.


Derived Types

type, public ::  string_type

Derived type of allocatable character to be stored in an array.

Components

Type Visibility Attributes Name Initial
character(len=:), public, allocatable :: data

Functions

public pure elemental function dm_string_count_char(str, a, quote) result(n)

Counts occurences of character a in str, with optional quoting (a in between quote characters is not counted).

Arguments

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

Input.

character(len=1), intent(in) :: a

Character to count.

character(len=1), intent(in), optional :: quote

Quote character.

Return Value integer

public function dm_string_count_lines(str) result(n)

Returns the number of line breaks in string.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(inout) :: str

Input string.

Return Value integer

public pure elemental function dm_string_count_substring(s1, s2) result(n)

Returns the number of occurences of string s2 in string s1.

Arguments

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

Input string.

character(len=*), intent(in) :: s2

Sub-string.

Return Value integer

public function dm_string_is_empty(str) result(is)

Returns .true. if given allocatable string is not passed, not allocated, or contains only white spaces.

Arguments

Type IntentOptional Attributes Name
character(len=:), intent(inout), optional, allocatable :: str

Input string.

Return Value logical

public pure function dm_string_is_present(str) result(is)

Returns .true. if given string is present and not empty.

Arguments

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

Input string.

Return Value logical

public pure function dm_string_is_printable(str) result(is)

Returns .true. if all characters is given string are printable ASCII characters.

Arguments

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

String to validate.

Return Value logical

public pure elemental function dm_string_to_lower(str) result(lower)

Returns given string in lower case.

Arguments

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

String to convert.

Return Value character(len=len)

Result.

public pure elemental function dm_string_to_upper(str) result(upper)

Returns given string in upper case.

Arguments

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

String to convert.

Return Value character(len=len)

Result.

public pure elemental function dm_string_starts_with(a, b) result(starts)

Returns .true. if string a starts with string b.

Arguments

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

First string.

character(len=*), intent(in) :: b

Second string.

Return Value logical


Subroutines

public pure elemental subroutine dm_string_type_allocate(string, n)

Allocates string type to empty character of length 0 or n, if not allocated already.

Arguments

Type IntentOptional Attributes Name
type(string_type), intent(inout) :: string

String type.

integer, intent(in), optional :: n

Length of string data.

public pure elemental subroutine dm_string_type_destroy(string)

Deallocates allocatable character inside of string type.

Arguments

Type IntentOptional Attributes Name
type(string_type), intent(inout) :: string

String type.

public pure elemental subroutine dm_string_lower(str)

Converts given string to lower case.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(inout) :: str

Input/output string.

public subroutine dm_string_replace(str, a, b)

Replaces character a in str with b.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(inout) :: str

String to parse.

character(len=1), intent(in) :: a

Character to replace.

character(len=1), intent(in) :: b

Substitute character.

public pure subroutine dm_string_split(str, array, del, n)

Splits a string by a given delimiter into an array of strings.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: str
character(len=*), intent(inout) :: array(:)
character(len=*), intent(in) :: del
integer, intent(out), optional :: n

public pure elemental subroutine dm_string_upper(str)

Converts given string to upper case.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(inout) :: str

Input/output string.