Thursday, September 24, 2015

Format Strings to Use a Percent Sign (%) Without the Formatter Multiplying the Value by 100

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.


No comments: