static void Main() { IntegerText c1 = new IntegerText(123456); int step = 1; for (int i = 0; i < 6; i++) { Console.WriteLine($"{step}의 자릿수" + c1[i]); step = step * 10; } }
public static void Main() { IntegerText Int = new IntegerText(123456); // 123456값을 가진 char배열을 생성 int step = 1; for (int i = 0; i < Int.ToString().Length; ++i) // Int가 가진 값은 char배열이므로 문자열로 변환하여 길이를 전달 { Console.WriteLine(step + "의 자릿수 : " + Int[i]); step *= 10; } }
static void Main(string[] args) { IntegerText aInt = new IntegerText(123456); int step = 1; for (int i = 0; i < aInt.ToString().Length; i++) { Console.WriteLine(step + "의 자릿수 : " + aInt[i]); step *= 10; } aInt[3] = '5'; Console.WriteLine(aInt.ToInt32()); }
protected override void FormatAll() { var formatter = ZNumberFormatter.Instance; // Custom: formatter.NumberToChars("(###) ###-####", Time.frameCount * 100 + 5555551234); _custom.Reset("Custom: ").Append(formatter); CustomFormatText.SetZString(_custom); // Currency: var amount = Time.realtimeSinceStartup; for (var i = 0; i < Prices.Length; i++) { formatter.NumberToChars("C", amount, _formats[i]); _prices[i].Reset("Currency: ").Append(formatter); Prices[i].SetZString(_prices[i]); } // Integer: formatter.NumberToChars("D6", Time.frameCount); _integer.Reset("Integer:").Append(formatter); IntegerText.SetZString(_integer); // Float: formatter.NumberToChars("F4", Mathf.Sin(Time.frameCount / 1000f)); _float.Reset("Float: ").Append(formatter); FloatText.SetZString(_float); // Scientific: formatter.NumberToChars("E4", Mathf.Cos(Time.frameCount / 1000f)); _science.Reset("Scientific: ").Append(formatter); ScientificText.SetZString(_science); // Time to Format: if (_count > 0) { formatter.NumberToChars("d3", _ticks / (_count * TimeSpan.TicksPerMillisecond / 1000)); _timeToFormat.Reset("Time to Format: ").Append(formatter).Append(" μs"); TimeToFormat.SetZString(_timeToFormat); } }