C# MVC String Format Zero Values -
i utilize format numbers.
@string.format("£{0:#,###,###.##}", 1000) outputs £1,000
however when come in 0 value this:
@string.format("£{0:#,###,###.##}", 0.0) outputs £
how create output when come in 0 values? e.g £0.0
thanks
the #
character means "only utilize digit when need to".
i suspect want:
@string.format("£{0:#,###,##0.##}", value)
however, generally improve thought use:
@string.format("{0:c}", value)
... , allow .net framework right thing.
c# string format
No comments:
Post a Comment