Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ FormatDigits() [2/2]

static unsafe void System.DateTimeFormat.FormatDigits ( StringBuilder outputBuffer,
int value,
int len,
bool overrideLengthLimit )
inlinestaticpackage

Definition at line 30 of file DateTimeFormat.cs.

31 {
32 if (!overrideLengthLimit && len > 2)
33 {
34 len = 2;
35 }
36 char* ptr = stackalloc char[16];
37 char* ptr2 = ptr + 16;
38 int num = value;
39 do
40 {
41 *(--ptr2) = (char)(num % 10 + 48);
42 num /= 10;
43 }
44 while (num != 0 && ptr2 > ptr);
45 int i;
46 for (i = (int)(ptr + 16 - ptr2); i < len; i++)
47 {
48 if (ptr2 <= ptr)
49 {
50 break;
51 }
52 *(--ptr2) = '0';
53 }
54 outputBuffer.Append(ptr2, i);
55 }
StringBuilder Append(char value, int repeatCount)

References System.Text.StringBuilder.Append(), System.len, and System.value.