2017年5月19日 星期五

【C#】String format copy paste note

抄貼字串格式用的

取到小數第2位
  1. String.Format("{0:0.00}", 123.4567); // "123.46"
  2. String.Format("{0:0.00}", 123.4); // "123.40"
  3. String.Format("{0:0.00}", 123.0); // "123.00"
  4. String.Format("{0:0.##}", 123.4567); // "123.46"
  5. String.Format("{0:0.##}", 123.4); // "123.4"
  6. String.Format("{0:0.##}", 123.0); // "123"
  7. Eval("ColName", "{0:0.##}%") // DataView Bind with %
ref: SO

沒有留言:

張貼留言