Helper function to manipulate numbers.
More...
|
static bool | IsInt (string valnum) |
| Checks if string is integer number.
|
|
static bool | IsIntGet (string valnum, bool removeFrontChars, out string resultstr, out long resultnum) |
| Checks if string is integer number.
|
|
static bool | IsReal (string valnum) |
| Checks if string is real number.
|
|
static bool | IsRealGet (string valnum, bool removeFrontChars, out string resultstr, out double resultnum) |
| Checks if string is real number.
|
|
static string | GetValFromSuspectExp (string valIn) |
| Check string to see if it is an exponential number. If so, it is converted into real number.
|
|
static string | ConvertMainFrame (string valin, string typ) |
| Converts a string representing a main frame formatted number with an encoded last character into a string of a real along with sign reversal if necessary Always makes last 2 digits into decimal portion so no further divide by 100 is necessary. If special char is within input string it becomes the end char and the remaining suffix is discarded. Leading zeros are truncated so 000.12 becomes 0.12 . Codes are: {= 0 }= 0 and negate a= 1 j= 1 and negate b= 2 k= 2 and negate c= 3 l= 3 and negate d= 4 m= 4 and negate e= 5 n= 5 and negate f= 6 o= 6 and negate g= 7 p= 7 and negate h= 8 q= 8 and negate i= 9 r= 9 and negate.
|
|
static string | GetBigDecimalFromExp (string valin) |
| Uses BigDecimal class to get a formatted real number from an exponential.
|
|
static string | CleanNumber (string numStr) |
| Cleans non-numeric prefix and suffix characters from number. Enclosing parens which is interpreted as negative indicator and replaced with -, while leading + is removed.
|
|
Helper function to manipulate numbers.
◆ CleanNumber()
static string VerityDotNet.NumFuncs.CleanNumber |
( |
string | numStr | ) |
|
|
static |
Cleans non-numeric prefix and suffix characters from number. Enclosing parens which is interpreted as negative indicator and replaced with -, while leading + is removed.
- Parameters
-
numStr | string of number to check. |
- Returns
- string starting with notok: if error
◆ ConvertMainFrame()
static string VerityDotNet.NumFuncs.ConvertMainFrame |
( |
string | valin, |
|
|
string | typ ) |
|
static |
Converts a string representing a main frame formatted number with an encoded last character into a string of a real along with sign reversal if necessary Always makes last 2 digits into decimal portion so no further divide by 100 is necessary. If special char is within input string it becomes the end char and the remaining suffix is discarded. Leading zeros are truncated so 000.12 becomes 0.12 . Codes are: {= 0 }= 0 and negate a= 1 j= 1 and negate b= 2 k= 2 and negate c= 3 l= 3 and negate d= 4 m= 4 and negate e= 5 n= 5 and negate f= 6 o= 6 and negate g= 7 p= 7 and negate h= 8 q= 8 and negate i= 9 r= 9 and negate.
strin original string of number value
typ conversion type: ibm. Default is ibm.
- Returns
- result or starts with 'notok:' if error
◆ GetBigDecimalFromExp()
static string VerityDotNet.NumFuncs.GetBigDecimalFromExp |
( |
string | valin | ) |
|
|
static |
Uses BigDecimal class to get a formatted real number from an exponential.
- Parameters
-
valin | original string of exponential format number |
- Returns
- string of real number
◆ GetValFromSuspectExp()
static string VerityDotNet.NumFuncs.GetValFromSuspectExp |
( |
string | valIn | ) |
|
|
static |
Check string to see if it is an exponential number. If so, it is converted into real number.
- Parameters
-
- Returns
- string of converted real number or original string. If error, starts with notok:
◆ IsInt()
static bool VerityDotNet.NumFuncs.IsInt |
( |
string | valnum | ) |
|
|
static |
Checks if string is integer number.
- Parameters
-
valnum | string to check. Non-numeric chars are not removed except for enclosing parens which is interpreted as negative indicator and removed |
- Returns
- bool
◆ IsIntGet()
static bool VerityDotNet.NumFuncs.IsIntGet |
( |
string | valnum, |
|
|
bool | removeFrontChars, |
|
|
out string | resultstr, |
|
|
out long | resultnum ) |
|
static |
Checks if string is integer number.
- Parameters
-
valnum | string to check |
removeFrontChars | optional bool whether to remove non-numeric chars as prefix. Default is false. Some chars are also handled like prefix - and +, as well as enclosing parens which is interpreted as negative indicator and removed |
resultstr | returned final result as string false:reason if fails (decimal, empty, non-numeric) |
resultnum | returned final result as integer -999999 if error |
- Returns
- bool
◆ IsReal()
static bool VerityDotNet.NumFuncs.IsReal |
( |
string | valnum | ) |
|
|
static |
Checks if string is real number.
- Parameters
-
valnum | string to check. Non-numeric chars are not removed except for enclosing parens which is interpreted as negative indicator and removed |
- Returns
- bool
◆ IsRealGet()
static bool VerityDotNet.NumFuncs.IsRealGet |
( |
string | valnum, |
|
|
bool | removeFrontChars, |
|
|
out string | resultstr, |
|
|
out double | resultnum ) |
|
static |
Checks if string is real number.
- Parameters
-
valnum | string to check |
removeFrontChars | optional bool whether to remove non-numeric chars as prefix. Default is false. Some chars are also handled like prefix - and +, as well as enclosing parens which is interpreted as negative indicator and removed |
resultstr | returned final result as string false:reason if fails (decimal, empty, non-numeric) |
resultnum | returned final result as real -999999.99 if error |
- Returns
- bool
The documentation for this class was generated from the following file:
- D:/CodeDevelopment/VS/VerityDotNet/NumFuncs.cs