There is a UDF for this called PadString I believe. Check cflib.org.

To do it by hand:

<cfset x = x & RepeatString(" ", 7 - Len(x))>

You could also do it in SQL I believe, and that would be the best
solution.

=======================================================================
Raymond Camden, ColdFusion Jedi Master for Hire

Email    : [EMAIL PROTECTED]
WWW      : www.camdenfamily.com/morpheus
Yahoo IM : morpheus

"My ally is the Force, and a powerful ally it is." - Yoda 

> -----Original Message-----
> From: Kris Pilles [mailto:[EMAIL PROTECTED]] 
> Sent: Tuesday, October 15, 2002 9:09 AM
> To: CF-Talk
> Subject: Setting variablelength
> 
> 
> I need to know how to set variable length on some query results I am
> amending to a text file.  For example the query returns a 7 digit
> student number but I need studentnumber to take up spaces... 
> Is there an
> easy way where I can add 2 spaces to the end of this query result... 
> 
> Ideally I would like to set variable x = a length of 9 y = 12 etc...
> This way if student number is returned as a 6 digit string I 
> don't need
> to do anythign else...
> 
> Please advise..
> 
> KP
> 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm

Reply via email to