Archiv

Archiv für November, 2007

String Format Patterns

30. November 2007 Keine Kommentare
string myName = "Fred";
String.Format("Name = {0}, hours = {1:hh}", myName, DateTime.Now);

The fixed text is “Name = ” and “, hours = “. The format items are “{0}”, whose index is 0, which corresponds to the object myName, and “{1:hh}”, whose index is 1, which corresponds to the object DateTime.Now.

Schöne Übersicht über die Formatmöglichkeiten:

http://alexonasp.net/samples/stringformatting/Default.aspx

http://msdn.microsoft.com/de-de/library/7x5bacwt(VS.80).aspx

Tags: