Format String Examples
- Last UpdatedJul 13, 2023
- 1 minute read
The following string is an example of a currency string:
String.Format("{0:$#,##0.00;($#,##0.00);Zero}", value);
This string example will output values as follows:
-
$1,240.00 if passed 1243.50.
-
($1,240.00) if passed -1243.50.
-
The string Zero if passed the number zero.
The following string is an example of a phone number string:
String.Format("{0:(###) ###-####}", 8005551212);
This string example will output (800) 555-1212.