public static void SetText(this TextMeshProUGUI text, long number, string format = null, bool forceSign = false) { bool isN0 = false; if (!string.IsNullOrEmpty(format)) { if (format == "N0") { isN0 = true; } else { text.SetText(number.ToString(format)); return; } } int cursor = bufferLength; var d = Math.Abs(number); if (d == 0) { cursor--; Buffer[cursor] = 48; } else { while (d > 0) { var r = (int)(d % 10); cursor--; Buffer[cursor] = r + 48; d = d / 10; ///instert ',' if (isN0) { if ((bufferLength - cursor) % 3 == 0 && d > 0) { cursor--; Buffer[cursor] = 44; } } } } if (forceSign || number < 0) { cursor--; Buffer[cursor] = number < 0 ? 45 : 43; } text.SetCharArray(Buffer, cursor, bufferLength - cursor); }