I had an application that needed to display a value with a percent sign (%) after it. The value had already been converted from decimal to integer, or in other words had already been multiplied by 100. I did not have the option to just append a % at the end of the string. All the object gave me access to was the format. I tried "#0%", which gave me what I wanted, except that it multiplied the value by 100, so 20% became 2000%.
After a little research I found that using an escape character gave me what I wanted.
ToString("#0\\%")
No comments:
Post a Comment