}
}
}
-
- if (number.sign && section == 0)
+
+ if (number.sign && (section == 0) && (number.scale != 0))
sb.Append(info.NegativeSign);
bool decimalWritten = false;
}
}
}
+
+ if (number.sign && (section == 0) && (number.scale == 0) && (sb.Length > 0))
+ sb.Insert(0, info.NegativeSign);
}
private static void FormatCurrency(ref ValueStringBuilder sb, ref NumberBuffer number, int nMaxDigits, NumberFormatInfo info)
_pos += count;
}
+ public void Insert(int index, string s)
+ {
+ int count = s.Length;
+
+ if (_pos > (_chars.Length - count))
+ {
+ Grow(count);
+ }
+
+ int remaining = _pos - index;
+ _chars.Slice(index, remaining).CopyTo(_chars.Slice(index + count));
+ s.AsSpan().CopyTo(_chars.Slice(index));
+ _pos += count;
+ }
+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Append(char c)
{