This module, fniDecimalUtil
contains procedures for working with decimal strings and the int32 data type.
Note
Procedures of this module are not pure procedures.
Uses
Functions
public function decToInt32(input, output, startpos, endpos) result(error)
- Author
- Khang Hoang Nguyen
- Since
- 1n.0.0.f
Parse the input
string as a signed decimal integer string to an int32 value.
Arguments
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | input | A string to be parsed as a signed decimal integer string to an int32 value. | ||
integer(kind=k_int32), | intent(out) | :: | output | An int32 value of the | ||
integer(kind=k_int32), | intent(in), | optional | :: | startpos | An int32 value of the position(inclusive) of where to start parsing. | |
integer(kind=k_int32), | intent(in), | optional | :: | endpos | An int32 value of the position(inclusive) of where to end parsing. |
Return Value logical
public function decToInt32TrueError(input, output, startpos, endpos) result(error)
- Author
- Khang Hoang Nguyen
- Since
- 1n.0.0.f
Parse the input
string as a signed decimal integer string to an int32 value.
Arguments
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | input | A string to be parsed as a signed decimal integer string to an int32 value. | ||
integer(kind=k_int32), | intent(out) | :: | output | An int32 value of the | ||
integer(kind=k_int32), | intent(in), | optional | :: | startpos | An int32 value of the position(inclusive) of where to start parsing. | |
integer(kind=k_int32), | intent(in), | optional | :: | endpos | An int32 value of the position(inclusive) of where to end parsing. |
Return Value integer(kind=k_int32)
public function decCompareAsInt32(firstString, secondString, output) result(error)
- Author
- Khang Hoang Nguyen
- Since
- 1n.0.0.f
Compare two strings as signed decimal integer strings by parsing them to int32 values first.
Arguments
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | firstString | A string to be compared to the string | ||
character(len=*), | intent(in) | :: | secondString | A string to be compared to the string | ||
integer(kind=k_int32), | intent(out) | :: | output | An int32 value of 1 if the |
Return Value logical
public function decInt32OrSmaller(firstString, secondString)
- Author
- Khang Hoang Nguyen
- Since
- 1n.0.0.f
Compare two strings bases on the content of the strings reference to int32 values. If the strings are valid signed decimal integer strings that can be parsed to int32 values then they will be compared base on their int32 values. Otherwise, the strings will be compared base on the priority ranking order below.
Arguments
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | firstString | A string to be compared to the string | ||
character(len=*), | intent(in) | :: | secondString | A string to be compared to the string |