-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0e91a46
commit a9529bb
Showing
2 changed files
with
48 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using System.Globalization; | ||
|
||
public class To | ||
{ | ||
private static NumberFormatInfo GetNumberFormatInfo() | ||
{ | ||
NumberFormatInfo Result = new NumberFormatInfo(); | ||
|
||
Result.NumberDecimalSeparator = "."; | ||
Result.NumberGroupSeparator = " "; | ||
Result.NumberGroupSizes = new int[] { 3 }; | ||
|
||
return Result; | ||
} | ||
|
||
public static Double Double(string Value) | ||
{ | ||
Value = Value.Replace(",", "."); | ||
return Convert.ToDouble(Value, GetNumberFormatInfo()); | ||
} | ||
|
||
public static Decimal Decimal(string Value) | ||
{ | ||
Value = Value.Replace(",", "."); | ||
return Convert.ToDecimal(Value, GetNumberFormatInfo()); | ||
} | ||
|
||
public static string String(decimal Value) | ||
{ | ||
return To.String("{0}", Value); | ||
} | ||
|
||
public static string String(string Format, double Value) | ||
{ | ||
return Value.ToString(Format, GetNumberFormatInfo()); | ||
} | ||
|
||
public static string String(string Format, Decimal Value) | ||
{ | ||
return Value.ToString(Format, GetNumberFormatInfo()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters