# Module: stringParsingUtilities

Contains all system defined business rules for parsing strings, with values of all kinds, and various parsing operations. Excluding functions that use the loggers.

Author:
  - Seth Hollingsead
Copyright:
  - Copyright © 2022-… by Seth Hollingsead. All rights reserved
Source:
  - businessRules/rules/stringParsingUtilities.js, line 2

### Requires

- @haystacks/constants
- path

### Methods

#### (inner) determineObjectDataType(inputData, inputMetaDataNot) → {string}

Determines if the contents of a string are actually a Boolean, Integer, Float, String or something else.

##### Parameters:

Name | Type | Description
--- | --- | ---
`inputData` | string | A string that contains some value that we should figure out what kind of data type that data is, Boolean, Integer, Float, String or something else.
`inputMetaDataNot` | string | Not used for this business rule.

Author:
  - Seth Hollingsead
Source:
  - businessRules/rules/stringParsingUtilities.js, line 176

##### Returns:

A string that indicates if the data type should be Boolean, Integer, Float, String or something else.

Type
  string

#### (inner) isBoolean(inputData, inputMetaData) → {boolean}

Determines if the input string is a boolean type of value, "true", "True", "TRUE", "t", "T", "y", "Y", "yes", "Yes", "YES", "on", "On", "ON" or "false", "False", "FALSE", "f", "F", "n", "N", "no", "No", "NO"

##### Parameters:

Name | Type | Description
--- | --- | ---
`inputData` | string | The string that should be checked if it is a Boolean style value or not, could be some form of "true" or "false".
`inputMetaData` | string | Not used for this business rule.

Author:
  - Seth Hollingsead
Source:
  - businessRules/rules/stringParsingUtilities.js, line 214

##### Returns:

A Boolean value of True or False to indicate if the input string is a Boolean or not.

Type
  boolean

#### (inner) isFloat(inputData, inputMetaData) → {boolean}

Determines if the input string is a floating point type of value or not.

##### Parameters:

Name | Type | Description
--- | --- | ---
`inputData` | string | The string that should be checked if it is an integer style value or not.
`inputMetaData` | string | Not used for this business rule.

Author:
  - Seth Hollingsead
Source:
  - businessRules/rules/stringParsingUtilities.js, line 285

##### Returns:

A Boolean value of true or false to indicate if the input string is a floating point number or not.

Type
  boolean

#### (inner) isInteger(inputData, inputMetaData) → {boolean}

Determines if the input string is an integer type of value -9007299254740992 to 9007299254740992.

##### Parameters:

Name | Type | Description
--- | --- | ---
`inputData` | string | The string that should be checked if it is an integer style value or not.
`inputMetaData` | string | Not used for this business rule.

Author:
  - Seth Hollingsead
Source:
  - businessRules/rules/stringParsingUtilities.js, line 250

##### Returns:

A Boolean value of true or false to indicate if the input string is an integer or not.

Type
  boolean

#### (inner) isString(inputData, inputMetaData) → {boolean}

Determines if the input string is a string or not, by process of elimination, aka if it's not a Boolean, and not an Integer and not a Float then it must be a string.

##### Parameters:

Name | Type | Description
--- | --- | ---
`inputData` | string | The string that should be checked if it is a string and not a Boolean, Integer or Float.
`inputMetaData` | string | Not used for this business rule.

Author:
  - Seth Hollingsead
Source:
  - businessRules/rules/stringParsingUtilities.js, line 314

##### Returns:

A Boolean value of true or false to indicate if the input string is a string and not a Boolean, Integer or Float; or not (meaning it would be one of those 3 data types, disguised as a string).

Type
  boolean

#### (inner) parseSystemRootPath(inputData, inputMetaData) → {string}

Parses the root path as returned by calling: path.resolve(__dirname); This business rule looks for the "AppName" part of the path and will parse that out to determine where on the hard drive this "appName" folder is installed at.

##### Parameters:

Name | Type | Description
--- | --- | ---
`inputData` | string | The root path as defined by calling path.resolve(__dirname);
`inputMetaData` | string | The name of the application.

Author:
  - Seth Hollingsead
Source:
  - businessRules/rules/stringParsingUtilities.js, line 26

##### Returns:

A string with the path up to the application folder, where ever that is installed on the local system currently executing.

Type
  string

#### (inner) replaceDoublePercentWithMessage(inputData, inputMetaData) → {string}

Parses the input string and replaces any instance of a double percentage sign with the input Meta Data string.

##### Parameters:

Name | Type | Description
--- | --- | ---
`inputData` | string | The string that might contain the double percentage signs.
`inputMetaData` | string | The string that should replace the double percentage signs.

Author:
  - Seth Hollingsead
Source:
  - businessRules/rules/stringParsingUtilities.js, line 347

##### Returns:

The modified string with the message inserted.

Type
  string

#### (inner) stringToBoolean(inputData, inputMetaData) → {boolean}

Converts a string to a boolean value.

##### Parameters:

Name | Type | Description
--- | --- | ---
`inputData` | string | A string that contains a truthy or falsy value and should be converted to a boolean value.
`inputMetaData` | string | Not used for this business rule.

Author:
  - Seth Hollingsead
Source:
  - businessRules/rules/stringParsingUtilities.js, line 135

##### Returns:

A Boolean value of either True or False according to the business rule conversion.

Type
  boolean

#### (inner) stringToDataType(inputData, inputMetaData) → {object|string|boolean|integer}

Converts a string to the appropriate data value. So if it's a string value of "3.1415926535897932384626433832" Then it will get converted to a float of the same value. If it's a string value of "false" then it will get converted to a boolean of the same value. If it's a string value of "12" then it will get converted to an integer of the same value. If it's a string value of "Happy Birthday" it will get returned the same as the input, no change, since it's just a string. If it's an array of strings, or collection object, it will get returned as the same as the input, no change.

##### Parameters:

Name | Type | Description
--- | --- | ---
`inputData` | string | The string that should be converted to some value.
`inputMetaData` | string | Not used for this business rule.

Author:
  - Seth Hollingsead
Source:
  - businessRules/rules/stringParsingUtilities.js, line 89

##### Returns:

Returns a value of whatever type the string should be converted to as appropriate.

Type
  object | string | boolean | integer

#### (inner) utilitiesReplaceCharacterWithCharacter(inputData, inputMetaData) → {string}

Replaces all of the specified character in the inputData with another specified character.

##### Parameters:

Name | Type | Description
--- | --- | ---
`inputData` | string | A string that may or may not contain the specified characters that should be converted to another specified character.
`inputMetaData` | array.<string, string> | An array of data that contains 2 additional string parameters: inputMetaData[0] === character2Find - The character to be searched and replaced from the input string. inputMetaData[1] === character2Replace - The character that should be used to replace the character specified for replacement from the input data.

Author:
  - Seth Hollingsead
Source:
  - businessRules/rules/stringParsingUtilities.js, line 372

##### Returns:

The same as the input string but with specified characters converted to the other specified character.

Type
  string