views:

36

answers:

3

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 formating? Thanks!

+2  A: 

Are you looking for this ?

Zebi
+1  A: 

You can start by checking the Composite Formatting article at MSDN. From there you will find links to standard format strings for numbers and dates, as well as links to the custom format strings for both numbers and dates.

Fredrik Mörk