The specific problem is that blanks is a numeric value; repeatString is a
function you should look at.
A simple one-liner, which will always give you a string of 18 characters,
padded as necessary:
<cfset FullTrackNo = LEFT((FullTrackNo & RepeatString(" ",18)),18)>
-----Original Message-----
From: Adrian Cesana [mailto:[EMAIL PROTECTED]]
Sent: Monday, October 09, 2000 12:41 PM
To: CF-Talk
Subject: padding string with blanks
I need to pass a string to a bar-coding process and it must have a fixed
length of 18, so if the string length is 10 I need to pad 8 blanks in front
of it. Ive been playing with the below code. I know it doesn't work but its
a start, what happens is the value of blanks get appended to the string
rather than appending actual blanks. Any idea on how to get the blanks in
there or a better method?
<cfif len(left(FullTrackNo,18)) LT 18>
<cfset blanks = 18 - len(left(FullTrackNo,18))>
<cfset TrackNo = '#insert(left(FullTrackNo,18), blanks, 0)#'>
<cfelse>
<cfset TrackNo = 'left(FullTrackNo,18)'>
</cfif>
Here is my padded string for the BarCode #TrackNo#
Thanks, Adrian
----------------------------------------------------------------------------
--
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.
------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.