c# - double.ToString("G") but always include point? -


is there formatting code assumes "g" formatting specification ensures decimal point shown?

for instance:

  • 1 = "1.0"
  • 123 = "123.0"
  • 10000 = "1e+4"

or need use following:

string str = somedouble.tostring(); if (!str.contains('.') && !str.contains('e') && !string.contains('e'))     str += ".0"; 

use can use n+count format count shows digit counts after . somedouble.tostring("n1")


Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -