C# Class NSupport.StringToNumberConversion

Provides extension methods for String for conversion and checking to other types.
Afficher le fichier Open project: jittuu/NSupport

Méthodes publiques

Méthode Description
AsDecimal ( this source ) : decimal?

Return converted Decimal if successfully parsed, otherwise null (Nothing in Visual Basic).

AsDecimal ( this source, NumberStyles style ) : decimal?

Return converted Decimal if successfully parsed, otherwise null (Nothing in Visual Basic).

AsDouble ( this source ) : double?

Return converted Double if successfully parsed, otherwise null (Nothing in Visual Basic).

AsDouble ( this source, NumberStyles style ) : double?

Return converted Double if successfully parsed, otherwise null (Nothing in Visual Basic).

AsInt32 ( this source ) : int?

Return converted Int32 if successfully parsed, otherwise null (Nothing in Visual Basic).

AsInt32 ( this source, NumberStyles style ) : int?

Return converted Int32 if successfully parsed, otherwise null (Nothing in Visual Basic).

AsInt64 ( this source ) : long?

Return converted Int64 if successfully parsed, otherwise null (Nothing in Visual Basic).

AsInt64 ( this source, NumberStyles style ) : long?

Return converted Int64 if successfully parsed, otherwise null (Nothing in Visual Basic).

IsNumber ( this source ) : bool

Return whether the provided String is number. It call overload method with this combination of NumberStyles (NumberStyles.AllowLeadingWhite | NumberStyles.AllowTrailingWhite | NumberStyles.AllowLeadingSign | NumberStyles.AllowTrailingSign | NumberStyles.AllowDecimalPoint | NumberStyles.AllowThousands;).

IsNumber ( this source, NumberStyles style ) : bool

Return whether the provided String is number with provided NumberStyles.

ToDecimal ( this source ) : decimal

Return converted Decimal.

ToDecimal ( this source, NumberStyles style ) : decimal

Return converted Decimal.

ToDouble ( this source ) : double

Return converted Double.

ToDouble ( this source, NumberStyles style ) : double

Return converted Double.

ToInt32 ( this source ) : int

Return converted Int32.

ToInt32 ( this source, NumberStyles style ) : int

Return converted Int32.

ToInt64 ( this source ) : long

Return converted Int64.

ToInt64 ( this source, NumberStyles style ) : long

Return converted Int64.

Method Details

AsDecimal() public static méthode

Return converted Decimal if successfully parsed, otherwise null (Nothing in Visual Basic).
public static AsDecimal ( this source ) : decimal?
source this A instance.
Résultat decimal?

AsDecimal() public static méthode

Return converted Decimal if successfully parsed, otherwise null (Nothing in Visual Basic).
public static AsDecimal ( this source, NumberStyles style ) : decimal?
source this A instance.
style NumberStyles A to parse against .
Résultat decimal?

AsDouble() public static méthode

Return converted Double if successfully parsed, otherwise null (Nothing in Visual Basic).
public static AsDouble ( this source ) : double?
source this A instance.
Résultat double?

AsDouble() public static méthode

Return converted Double if successfully parsed, otherwise null (Nothing in Visual Basic).
public static AsDouble ( this source, NumberStyles style ) : double?
source this A instance.
style NumberStyles A to parse against .
Résultat double?

AsInt32() public static méthode

Return converted Int32 if successfully parsed, otherwise null (Nothing in Visual Basic).
public static AsInt32 ( this source ) : int?
source this A instance.
Résultat int?

AsInt32() public static méthode

Return converted Int32 if successfully parsed, otherwise null (Nothing in Visual Basic).
public static AsInt32 ( this source, NumberStyles style ) : int?
source this A instance.
style NumberStyles A to parse against .
Résultat int?

AsInt64() public static méthode

Return converted Int64 if successfully parsed, otherwise null (Nothing in Visual Basic).
public static AsInt64 ( this source ) : long?
source this A instance.
Résultat long?

AsInt64() public static méthode

Return converted Int64 if successfully parsed, otherwise null (Nothing in Visual Basic).
public static AsInt64 ( this source, NumberStyles style ) : long?
source this A instance.
style NumberStyles A to parse against .
Résultat long?

IsNumber() public static méthode

Return whether the provided String is number. It call overload method with this combination of NumberStyles (NumberStyles.AllowLeadingWhite | NumberStyles.AllowTrailingWhite | NumberStyles.AllowLeadingSign | NumberStyles.AllowTrailingSign | NumberStyles.AllowDecimalPoint | NumberStyles.AllowThousands;).
public static IsNumber ( this source ) : bool
source this A instance.
Résultat bool

IsNumber() public static méthode

Return whether the provided String is number with provided NumberStyles.
public static IsNumber ( this source, NumberStyles style ) : bool
source this A instance.
style NumberStyles A to check against .
Résultat bool

ToDecimal() public static méthode

Return converted Decimal.
Throws when is null. Throws when is not correct format. Throws when represents a number less than or greater than .
public static ToDecimal ( this source ) : decimal
source this A instance.
Résultat decimal

ToDecimal() public static méthode

Return converted Decimal.
Throws when is null. Throws when is not correct format. Throws when represents a number less than or greater than . Throws when is not valid
public static ToDecimal ( this source, NumberStyles style ) : decimal
source this A instance.
style NumberStyles A to parse against .
Résultat decimal

ToDouble() public static méthode

Return converted Double.
Throws when is null. Throws when is not correct format. Throws when represents a number less than or greater than .
public static ToDouble ( this source ) : double
source this A instance.
Résultat double

ToDouble() public static méthode

Return converted Double.
Throws when is null. Throws when is not correct format. Throws when represents a number less than or greater than . Throws when is not valid
public static ToDouble ( this source, NumberStyles style ) : double
source this A instance.
style NumberStyles A to parse against .
Résultat double

ToInt32() public static méthode

Return converted Int32.
Throws when is null. Throws when is not correct format. Throws when represents a number less than or greater than .
public static ToInt32 ( this source ) : int
source this A instance.
Résultat int

ToInt32() public static méthode

Return converted Int32.
Throws when is null. Throws when is not correct format. Throws when represents a number less than or greater than . Throws when is not valid
public static ToInt32 ( this source, NumberStyles style ) : int
source this A instance.
style NumberStyles A to parse against .
Résultat int

ToInt64() public static méthode

Return converted Int64.
Throws when is null. Throws when is not correct format. Throws when represents a number less than or greater than .
public static ToInt64 ( this source ) : long
source this A instance.
Résultat long

ToInt64() public static méthode

Return converted Int64.
Throws when is null. Throws when is not correct format. Throws when represents a number less than or greater than . Throws when is not valid
public static ToInt64 ( this source, NumberStyles style ) : long
source this A instance.
style NumberStyles A to parse against .
Résultat long