|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
||||
|
||||
|
Padding with zeroes
Hi,
I have a number I need to display that can be up to 7 digits long. If the number is less than 1000000 they want the leading spaces filled with zeroes. Thus, 53489 would be displayed as 0053489. In other languages I would use sprintf, but I can't find anything quite like that in CF. Any help appreciated, wdn2k |
|
#2
|
|||
|
|||
|
<cfoutput>#numberFormat( 53489, '0000000' )#</cfoutput>
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian. How to Post a Question in the Forums |
|
#3
|
||||
|
||||
|
Thanks.
I came up with another solution that involved checking the length, figuring out the difference, and looping that number of times to prepend the zeroes, but your solutiuon is MUCH cleaner. I knew there had to be an easy solution for this common problem. wdn2k |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > Padding with zeroes |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|