foreng_io_char Module

A module to deal with the manipulation of characters based on their ASCII collating sequence.

This module provides public parameters that are common ASCII cutoff values when dealing with alphanumeric characters.


Contents


Variables

TypeVisibility AttributesNameInitial
integer, public, parameter:: ZERO_ASCII =48

ASCII value of the digit '0'

integer, public, parameter:: NINE_ASCII =57

ASCII value of the digit '9'

integer, public, parameter:: UPPER_A_ASCII =65

ASCII VALUE of the character 'A'

integer, public, parameter:: UPPER_Z_ASCII =90

ASCII VALUE of the character 'Z'

integer, public, parameter:: LOWER_A_ASCII =97

ASCII VALUE of the character 'a'

integer, public, parameter:: LOWER_Z_ASCII =122

ASCII VALUE of the character 'z'

integer, public, parameter:: UPPER_LOWER_OFFSET =32

The difference between UPPER_A_ASCII and LOWER_A_ASCII


Functions

public elemental function is_alphnum(char)

Check if a character is alphanumeric This function checks the ASCII collating sequence of the passed character and returns true if the character is alpha (A-Z, a-z) or numeric (0-9)

Arguments

Type IntentOptional AttributesName
character(len=1), intent(in) :: char

Return Value logical

public elemental function is_alph(char)

Check if a character belongs to the alphabet This function checks the ASCII collating sequence of the passed character and returns true if the character belongs to the Roman alphabet.

Arguments

Type IntentOptional AttributesName
character(len=1), intent(in) :: char

Return Value logical

public elemental function is_num(char)

Check if a character is a numerical digit. Return true if a character is between 0-9

Arguments

Type IntentOptional AttributesName
character(len=1), intent(in) :: char

Return Value logical

public elemental function is_lower(char)

Check if a character is a lowercase alpha character Returns true if the ASCII value of char lies between LOWER_A_ASCII and LOWER_Z_ASCII

Arguments

Type IntentOptional AttributesName
character(len=1), intent(in) :: char

Return Value logical

public elemental function is_upper(char)

Check if a character is a uppercase alpha character Returns true if the ASCII value of char lies between UPPER_A_ASCII and UPPER_Z_ASCII

Arguments

Type IntentOptional AttributesName
character(len=1), intent(in) :: char

Return Value logical

public elemental function to_lower(char) result(char_upper)

Convert an uppercase alpha character to its lowercase counterpart. If the passed character is not uppercase, return the same character.

Arguments

Type IntentOptional AttributesName
character(len=1), intent(in) :: char

Return Value character(len=1)

public elemental function to_upper(char) result(char_lower)

Convert a lowercase alpha character to its uppercase counterpart. If the passed character is not lowercase, return the same character.

Arguments

Type IntentOptional AttributesName
character(len=1), intent(in) :: char

Return Value character(len=1)