Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Advanced formatting rules for StringBuilder.AppendFormat

I've seen on this site a StringBuilder code sample illustrating AppendFormat usage:

using System;
using System.Text;

class Program
{
    static int[] _v = new int[]
    {
        1,
        4,
        6
    };

    static void Main()
    {
        StringBuilder b = new StringBuilder();
        foreach (int v in _v)
        {
            b.AppendFormat("int: {0:0.0}{1}", v,
                Environment.NewLine);
        }
        Console.WriteLine(b.ToString());
    }
}
=== Output of the program ===

int: 1.0
int: 4.0
int: 6.0

Where can I find documentation on those advanced rules for string formatting?

like image 942
Stringer Avatar asked Dec 23 '22 00:12

Stringer


1 Answers

  • Composite Formatting
  • Standard Numeric Format Strings
  • Custom Numeric Format Strings
  • Standard Date and Time Format Strings
  • Custom Date and Time Format Strings
like image 94
LukeH Avatar answered Jan 05 '23 08:01

LukeH