Infolink

 

Search This Blog

Showing posts with label WCF. Show all posts
Showing posts with label WCF. Show all posts

Nov 30, 2012

String.Format in Asp.Net (PART-2)

Culture Information

string.format also provides a method which accepts a CultureInfo argument, as an IFormatProvider. This is important when trying to write portable and localisable code, as, for example, month names will change according to the local culture of the machine you are running on. Rather than simply call the standard String.Format you should consider always calling the overloaded culture method. If you don't need to specify a culture you can use the System.Globalization.CultureInfo.InvariantCulture. This will then default your formatting to English, as opposed to the culture of the current thread.

String.Format in Asp.Net (PART-1)

Formatting Strings

There's not much formatting that can be applied to a string. Only the padding / alignment formatting options can be applied. These options are also available to every argument, regardless of type.
example output
String.Format("--{0,10}--", "test"); --      test--
String.Format("--{0,-10}--", "test"); --test      --

Related Posts Plugin for WordPress, Blogger...