Re: adding spaces
Re: adding spaces
- Subject: Re: adding spaces
- From: "Marc K. Myers" <email@hidden>
- Date: Tue, 26 Aug 2003 14:22:28 -0400
Date: Mon, 25 Aug 2003 20:15:09 -0700 (PDT)
From: Natalie Lambert <email@hidden>
Subject: adding spaces
To: email@hidden
I'm finding lots of references on triming spaces but
nothing on adding spaces...
I need to take a piece of data and ensure it is a
specific character length. If the number of charaters
are less than those required then I need to fill the
rest with spaces
ie
the space the heading needs to fill is 20 characters
the heading is "Cars"
the script needs to:
set x to count characters of heading
subtract x from 20
add one space for the remainder
--in this case cars + 16 spaces
I know this is going to need a repeat function but I'm
a little unclear on the adding spaces bit since I
haven't scripted in a while.
This works without a repeat:
property spaceBar : " " -- 20 spaces
set inText to "Cars"
set spaceLng to 20 - (length of inText)
set inText to inText & (text 1 thru spaceLng of spaceBar)
{inText, length of inText}
Marc [08/26/03 2:22:25 PM]
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.