Need a custom currency format to use with String.Format

前端 未结 5 666
無奈伤痛
無奈伤痛 2021-01-04 05:55

I\'m trying to use String.Format(\"{0:c}\", somevalue) in C# but am having a hard time figuring out how to configure the output to meet my needs. Here are my needs:

5条回答
  •  醉梦人生
    2021-01-04 06:25

    Try something like this:

    String currency = (number == 0) ? String.Empty : number.ToString("c");
    

提交回复
热议问题