9using System.Globalization;
43 public static bool StartsWith(
string input,
string value)
45 if (input ==
null && value ==
null)
49 else if (input ==
null && value !=
null)
53 else if (value ==
null)
57 return input.StartsWith(value, StringComparison.InvariantCulture);
76 public static string ToUpper(
string input)
78 return !
string.IsNullOrEmpty(input) ? input.ToUpper(
InvariantCulture) : input;
86 public static string ToLower(
string input)
88 return !
string.IsNullOrEmpty(input) ? input.ToLower(
InvariantCulture) : input;
208 if (value ==
null || (!value.Contains(
'\n') && !value.Contains(
'\r')))
212 return value.Replace(
"\n\r",
"\n").Replace(
"\r\n",
"\n").Replace(
"\r",
"\n").Replace(
"\n",
"\r\n");
242 if (
string.IsNullOrEmpty(rawValue))
259 if (rawValue ==
"true")
275 public static bool TryParseInt(
string rawValue, out
int parsedValue)
277 return int.TryParse(rawValue, NumberStyles.Integer,
InvariantCulture, out parsedValue);
288 return uint.TryParse(rawValue, NumberStyles.Integer,
InvariantCulture, out parsedValue);
299 return long.TryParse(rawValue, NumberStyles.Integer,
InvariantCulture, out parsedValue);
310 return ulong.TryParse(rawValue, NumberStyles.Integer,
InvariantCulture, out parsedValue);
321 return float.TryParse(rawValue, NumberStyles.Any, CultureInfo.InvariantCulture, out parsedValue);
332 return decimal.TryParse(rawValue, NumberStyles.Float,
InvariantCulture, out parsedValue);
343 return double.TryParse(rawValue, NumberStyles.Any,
InvariantCulture, out parsedValue);
Class providing static methods to parse string values to specific types or to print object as languag...
static string ToString(long input)
Transforms a long to an invariant sting.
const string NumericFormat
Numeric format for ToString conversions. This format ensures that a numeric value is printed in a lan...
static string ToString(byte input)
Transforms a byte to an invariant sting.
static readonly CultureInfo InvariantCulture
Constant for number conversion. The invariant culture (represents mostly the US numbering scheme) ens...
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 string ToString(double input)
Transforms a double to an invariant sting.
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 string ToString(ulong input)
Transforms a ulong to an invariant sting.
static bool StartsWith(string input, string value)
Determines whether a string starts with a specific value.
static string ToUpper(string input)
Transforms a string to upper case with null check and invariant culture.
static string ToString(short input)
Transforms a short to an invariant sting.
static string ToString(sbyte input)
Transforms a sbyte to an invariant sting.
static string ToString(decimal input)
Transforms a decimal to an invariant sting.
static string ToLower(string input)
Transforms a string to lower case with null check and invariant culture.
static bool TryParseInt(string rawValue, out int parsedValue)
Tries to parse an int independent of 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 string ToString(uint input)
Transforms a uint 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 bool NotStartsWith(string input, string value)
Determines whether a string does not start with a specific value.
static int ParseInt(string rawValue)
Parses an int independent from 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 string ToString(float input)
Transforms a float to an invariant sting.
static string NormalizeNewLines(string value)
Normalizes all newlines of a string to CR+LF.
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),...
static string ToString(int input)
Transforms an integer to an invariant sting.
static bool TryParseDouble(string rawValue, out double parsedValue)
Tries to parse a double (with any parsing style) independent from the culture info of the host.