

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
The "E" and "e" custom specifiers in C#
If any of the following string appears in the format string and followed by at least one zero, then the number is formatted with an “E” or “e” in between the number and the exponent.
"E" "E+" "E-" "e" "e+" "e-"
Example
using System; using System.Globalization; class Demo { static void Main() { double num = 9400; Console.WriteLine(num.ToString("0.###E+0", CultureInfo.InvariantCulture)); Console.WriteLine(String.Format(CultureInfo.InvariantCulture, "{0:0.###E+0}", num)); Console.WriteLine(num.ToString("0.###E+000", CultureInfo.InvariantCulture)); Console.WriteLine(String.Format(CultureInfo.InvariantCulture, "{0:0.###E+000}", num)); } }
Output
9.4E+3 9.4E+3 9.4E+003 9.4E+003
- Related Questions & Answers
- The "%" custom specifier in C#
- The "#" custom specifier in C#
- "." custom specifier in C#
- The "0" custom format specifier in C#
- Difference between "." and "#" selector in CSS
- "static const" vs "#define" vs "enum" ?
- Difference between "new operator" and "operator new" in C++?
- Difference between "fold" and "reduce" in Kotlin
- Difference between "*" and "Any" in Kotlin generics
- What is the difference between "std::endl" and "\n" in C++?
- Month ("M", "m") Format Specifier in C#
- What's the difference between "!!" and "?" in Kotlin?
- What's the difference between "STL" and "C++ Standard Library"?
- Comparison between "&&" and "AND" operator in PHP.
- Equality checks in Kotlin (Difference between "==" and "===" Operators)
Advertisements