|
NanoXLSX.Core 3.2.1
|
Class providing static methods to parse string values to specific types or to print object as language neutral string. More...
Static Public Member Functions | |
| static bool | StartsWith (string input, string value) |
| Determines whether a string starts with a specific value. | |
| static bool | NotStartsWith (string input, string value) |
| Determines whether a string does not start with a specific value. | |
| static string | ToUpper (string input) |
| Transforms a string to upper case with null check and invariant culture. | |
| static string | ToLower (string input) |
| Transforms a string to lower case with null check and invariant culture. | |
| static string | ToString (int input) |
| Transforms an integer to an invariant sting. | |
| static string | ToString (float input) |
| Transforms a float to an invariant sting. | |
| static string | ToString (byte input) |
| Transforms a byte to an invariant sting. | |
| static string | ToString (sbyte input) |
| Transforms a sbyte to an invariant sting. | |
| static string | ToString (double input) |
| Transforms a double to an invariant sting. | |
| static string | ToString (decimal input) |
| Transforms a decimal to an invariant sting. | |
| static string | ToString (uint input) |
| Transforms a uint to an invariant sting. | |
| static string | ToString (long input) |
| Transforms a long to an invariant sting. | |
| static string | ToString (ulong input) |
| Transforms a ulong to an invariant sting. | |
| static string | ToString (short input) |
| Transforms a short to an invariant sting. | |
| static string | ToString (ushort input) |
| Transforms a ushort to an invariant sting. | |
| static float | ParseFloat (string rawValue) |
| Parses a float independent from the culture info of the host. | |
| static int | ParseInt (string rawValue) |
| Parses an int independent from the culture info of the host. | |
| static double | ParseDouble (string rawValue) |
| Parses a double independent from the culture info of the host. | |
| static int | ParseBinaryBool (String rawValue) |
| Parses a bool as a binary number either based on an int (0/1) or a string expression (true/ false), independent of the culture info of the host. | |
| static bool | TryParseBool (string rawValue, out bool parsedValue) |
| Tries to parse a bool from its string name (true/false), independent from the case. | |
| static bool | TryParseInt (string rawValue, out int parsedValue) |
| Tries to parse an int independent of the culture info of the host. | |
| static bool | TryParseUint (string rawValue, out uint parsedValue) |
| Tries to parse an unsigned int (uint) independent from the culture info of the host. | |
| static bool | TryParseLong (string rawValue, out long parsedValue) |
| Tries to parse a long independent from the culture info of the host. | |
| static bool | TryParseUlong (string rawValue, out ulong parsedValue) |
| Tries to parse an unsigned long (ulong) independent from the culture info of the host. | |
| static bool | TryParseFloat (string rawValue, out float parsedValue) |
| Tries to parse a float (with any parsing style) independent from the culture info of the host. | |
| static bool | TryParseDecimal (string rawValue, out decimal parsedValue) |
| Tries to parse a decimal (with float parsing style) independent from the culture info of the host. | |
| static bool | TryParseDouble (string rawValue, out double parsedValue, NumberStyles numberStyles=NumberStyles.Any) |
| Tries to parse a double independent from the culture info of the host. | |
| static string | NormalizeNewLines (string value) |
| Normalizes all newlines of a string to CR+LF. | |
| static bool | IsAsciiDigit (char character) |
| Determines whether the passed character is a ASCII digit character (0-9). | |
| static string | ToCachedValueString (object input, bool convertBoolToNumber=true) |
| Transforms a given object to a string displayed as cached Values. The common known compatible numeric types, like int, float, sbyte etc. will be transformed to their appropriate string representations. Bool will be either 0 or 1, or to TRUE or FALSE if convertBoolToNumber is set to false. Date or TimeSpan will be transformed to a OADate (numeric) value. Null or an empty string will be transformed to 0. If an unknown object type is passed, its own ToString() method will be used. | |
| static bool | TryParseFormulaStringConstant (string expression, out string value, bool enclosingQuotesRemoved=false) |
Tries to parse a raw string as an Excel formula string constant. Escaped double quotes ("") are converted to single double quotes ("). | |
| static bool | TryParseWorksheetQualifiedReference (string expression, out string worksheetName, out string reference) |
| Tries to parse a qualifies worksheet name and address or range expression from a raw string. | |
Static Public Attributes | |
| const string | NumericFormat = "G" |
| Numeric format for ToString conversions. This format ensures that a numeric value is printed in a language neutral way. | |
| static readonly CultureInfo | InvariantCulture = CultureInfo.InvariantCulture |
| Constant for number conversion. The invariant culture (represents mostly the US numbering scheme) ensures that no culture-specific punctuations are used when converting numbers to strings, This is especially important for OOXML number values. See also: https://docs.microsoft.com/en-us/dotnet/api/system.globalization.cultureinfo.invariantculture?view=net-5.0. | |
Class providing static methods to parse string values to specific types or to print object as language neutral string.
Definition at line 19 of file ParserUtils.cs.
|
static |
Determines whether the passed character is a ASCII digit character (0-9).
| character | Character to check |
Definition at line 369 of file ParserUtils.cs.
|
static |
Normalizes all newlines of a string to CR+LF.
| value | Input value |
Definition at line 355 of file ParserUtils.cs.
|
static |
Determines whether a string does not start with a specific value.
| input | String to check |
| value | Value to be checked, whether it occurs not at the beginning of the input string |
Definition at line 68 of file ParserUtils.cs.
|
static |
Parses a bool as a binary number either based on an int (0/1) or a string expression (true/ false), independent of the culture info of the host.
| rawValue | Raw number or expression as string |
Definition at line 241 of file ParserUtils.cs.
|
static |
Parses a double independent from the culture info of the host.
| rawValue | Raw number as string |
Definition at line 231 of file ParserUtils.cs.
|
static |
Parses a float independent from the culture info of the host.
| rawValue | Raw number as string |
Definition at line 209 of file ParserUtils.cs.
|
static |
Parses an int independent from the culture info of the host.
| rawValue | Raw number as string |
Definition at line 220 of file ParserUtils.cs.
|
static |
Determines whether a string starts with a specific value.
| input | String to check |
| value | Value to be checked, whether it occurs at the beginning of the input string |
Definition at line 45 of file ParserUtils.cs.
|
static |
Transforms a given object to a string displayed as cached Values. The common known compatible numeric types, like int, float, sbyte etc. will be transformed to their appropriate string representations.
Bool will be either 0 or 1, or to TRUE or FALSE if convertBoolToNumber is set to false. Date or TimeSpan will be transformed to a OADate (numeric) value. Null or an empty string will be transformed to 0. If an unknown object type is passed, its own ToString() method will be used.
| input | Object to transform |
| convertBoolToNumber | If set to true, a bool value will be 1 or 0, otherwise TRUE or FALSE. Default is true |
| Exceptions.FormatException | Thrown if an invalid Date value was passed. See method DataUtils.GetOADateTimeString(DateTime) for details |
Definition at line 388 of file ParserUtils.cs.
|
static |
Transforms a string to lower case with null check and invariant culture.
| input | String to transform |
Definition at line 88 of file ParserUtils.cs.
|
static |
Transforms a byte to an invariant sting.
| input | Byte to transform |
Definition at line 118 of file ParserUtils.cs.
|
static |
Transforms a decimal to an invariant sting.
| input | Decimal to transform |
Definition at line 148 of file ParserUtils.cs.
|
static |
Transforms a double to an invariant sting.
| input | Double to transform |
Definition at line 138 of file ParserUtils.cs.
|
static |
Transforms a float to an invariant sting.
| input | Float to transform |
Definition at line 108 of file ParserUtils.cs.
|
static |
Transforms an integer to an invariant sting.
| input | Integer to transform |
Definition at line 98 of file ParserUtils.cs.
|
static |
Transforms a long to an invariant sting.
| input | Long to transform |
Definition at line 168 of file ParserUtils.cs.
|
static |
Transforms a sbyte to an invariant sting.
| input | Sbyte to transform |
Definition at line 128 of file ParserUtils.cs.
|
static |
Transforms a short to an invariant sting.
| input | Short to transform |
Definition at line 188 of file ParserUtils.cs.
|
static |
Transforms a uint to an invariant sting.
| input | Uint to transform |
Definition at line 158 of file ParserUtils.cs.
|
static |
Transforms a ulong to an invariant sting.
| input | Ulong to transform |
Definition at line 178 of file ParserUtils.cs.
|
static |
Transforms a ushort to an invariant sting.
| input | Ushort to transform |
Definition at line 198 of file ParserUtils.cs.
|
static |
Transforms a string to upper case with null check and invariant culture.
| input | String to transform |
Definition at line 78 of file ParserUtils.cs.
|
static |
Tries to parse a bool from its string name (true/false), independent from the case.
| rawValue | Raw bool as string |
| parsedValue | Parsed bool |
/remark
Integer values, like 0 or 1 will return false
Definition at line 267 of file ParserUtils.cs.
|
static |
Tries to parse a decimal (with float parsing style) independent from the culture info of the host.
| rawValue | Raw number as string |
| parsedValue | Parsed decimal |
Definition at line 333 of file ParserUtils.cs.
|
static |
Tries to parse a double independent from the culture info of the host.
| rawValue | Raw number as string |
| parsedValue | Parsed double |
| numberStyles | Permitted number styles. Default is NumberStyles.Any |
Definition at line 345 of file ParserUtils.cs.
|
static |
Tries to parse a float (with any parsing style) independent from the culture info of the host.
| rawValue | Raw number as string |
| parsedValue | Parsed float |
Definition at line 322 of file ParserUtils.cs.
|
static |
Tries to parse a raw string as an Excel formula string constant. Escaped double quotes ("") are converted to single double quotes (").
| expression | Raw string expression. |
| value | Parsed and unescaped string value as out parameter. |
| enclosingQuotesRemoved | If true, the enclosing leading and trailing double quotes have already been removed. Default is false. |
Definition at line 440 of file ParserUtils.cs.
|
static |
Tries to parse an int independent of the culture info of the host.
| rawValue | Raw number as string |
| parsedValue | Parsed int |
Definition at line 278 of file ParserUtils.cs.
|
static |
Tries to parse a long independent from the culture info of the host.
| rawValue | Raw number as string |
| parsedValue | Parsed long |
Definition at line 300 of file ParserUtils.cs.
|
static |
Tries to parse an unsigned int (uint) independent from the culture info of the host.
| rawValue | Raw number as string |
| parsedValue | Parsed uint |
Definition at line 289 of file ParserUtils.cs.
|
static |
Tries to parse an unsigned long (ulong) independent from the culture info of the host.
| rawValue | Raw number as string |
| parsedValue | Parsed ulong |
Definition at line 311 of file ParserUtils.cs.
|
static |
Tries to parse a qualifies worksheet name and address or range expression from a raw string.
| expression | Raw expression to parse |
| worksheetName | Resolved worksheet name as out parameter |
| reference | Resolved address or range expression as string (out parameter) |
Definition at line 501 of file ParserUtils.cs.
|
static |
Constant for number conversion. The invariant culture (represents mostly the US numbering scheme) ensures that no culture-specific punctuations are used when converting numbers to strings, This is especially important for OOXML number values. See also: https://docs.microsoft.com/en-us/dotnet/api/system.globalization.cultureinfo.invariantculture?view=net-5.0.
Definition at line 34 of file ParserUtils.cs.
|
static |
Numeric format for ToString conversions. This format ensures that a numeric value is printed in a language neutral way.
Definition at line 26 of file ParserUtils.cs.