here is a perl example you might be able to change to CF.
#pad with leading spaces
while (length($FullTrackNo) < 18){
$FullTrackNo=" " . $FullTrackNo;
}
"Adrian Cesana" <[EMAIL PROTECTED]> wrote:
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.
____________________________________________________________________
Get free email and a permanent address at http://www.netaddress.com/?N=1
------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebarRsts&bodyRsts/cf_talk or send a message
to [EMAIL PROTECTED] with 'unsubscribe' in the body.