mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-20 00:50:25 +02:00
Hooked up NumberFormatter calls for all int type ToString methods
This commit is contained in:
parent
f9ee4010cb
commit
0e873f535e
8 changed files with 48 additions and 124 deletions
|
@ -97,27 +97,14 @@ namespace System
|
|||
|
||||
public void ToString(String outString, String format, IFormatProvider formatProvider)
|
||||
{
|
||||
int minNumerals = -1;
|
||||
|
||||
//TOTAL HACK:
|
||||
if (format != null)
|
||||
if(format == null || format.IsEmpty)
|
||||
{
|
||||
if (format.StartsWith("X"))
|
||||
{
|
||||
((UInt64)(uint32)this).ToString(outString, format, formatProvider);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((format.Length > 0) && (format[0] == '0'))
|
||||
{
|
||||
if (Int32.Parse(format) case .Ok(let wantLen))
|
||||
{
|
||||
minNumerals = wantLen;
|
||||
}
|
||||
}
|
||||
ToString(outString);
|
||||
}
|
||||
else
|
||||
{
|
||||
NumberFormatter.NumberToString(format, (uint32)this, formatProvider, outString);
|
||||
}
|
||||
|
||||
ToString(outString, minNumerals);
|
||||
}
|
||||
|
||||
public static Result<uint32, ParseError> Parse(StringView val)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue