Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static String FormatBigInteger(BigInteger value, String format, NumberFormatInfo info) {
- int digits = 0;
- char fmt = ParseFormatSpecifier(format, out digits);
- if (fmt == 'x' || fmt == 'X')
- return FormatBigIntegerToHexString(value, fmt, digits, info);
- bool decimalFmt = (fmt == 'g' || fmt == 'G' || fmt == 'd' || fmt == 'D' || fmt == 'r' || fmt == 'R');
- if (!decimalFmt) {
- // Silverlight supports invariant formats only
- throw new FormatException(SR.GetString(SR.Format_InvalidFormatSpecifier));
- }
- if (value._bits == null) {
- if (fmt == 'g' || fmt == 'G' || fmt == 'r' || fmt == 'R') {
- if (digits > 0)
- format = String.Format(CultureInfo.InvariantCulture, "D{0}", digits.ToString(CultureInfo.InvariantCulture));
- else
- format = "D";
- }
- return value._sign.ToString(format, info);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement