• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: adding spaces
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Prev by Date: Re: Connection invalid on quit
  • Next by Date: InDesign: Linked text frames and master pages
  • Previous by thread: Re: adding spaces
  • Next by thread: Keystroke command limit
  • Index(es):
    • Date
    • Thread