tags:

views:

316

answers:

2

In Coldfusion / CFML I need to convert 0.85035035035 to 85%. I looked at numberFormat(), but it's output looks like, "0.85". There doesn't seem to have a method to omit the leading "0.".

<cfset myNumber = 0.85035035035>
<cfoutput>
    #numberFormat(myNumber, "0.00")#%
</cfoutput>

Outputs: 0.85%

Ideas? Do I need to trim the leading 2 characters in a second operation?

<cfset myNumber = 0.85035035035>
<cfset myPercent = numberFormat(myNumber, "0.00")>
<cfoutput>
    #right(myPercent, 2)# %
</cfoutput>
+3  A: 
 <cfset num = 0.85>
 <cfoutput>#NumberFormat(num * 100,"999")#%</cfoutput>
kevink
+7  A: 
<cfoutput>#Round(myNumber * 100)#%</cfoutput>
Henry