• 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: Trim space chars from start of line
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Trim space chars from start of line


  • Subject: Re: Trim space chars from start of line
  • From: Deivy Petrescu <email@hidden>
  • Date: Mon, 25 Jul 2011 18:16:44 -0400

On Jul 25, 2011, at 17:17 , Zavatone, Alex wrote:

>
> On Jul 25, 2011, at 4:03 PM, Deivy Petrescu wrote:
>
>> (script)
>> set t to "      set myText to characters 2 through myLength of myText as string"
>> set t to characters of t
>> if (contents of item 1 of t) = space then repeat while (contents of item 1 of t) is space
>> 	set t to rest of t
>> end repeat
>> t as string
>> (script)
>>
>
> Wow.  That's crazy.
>
> Unfortunately, it fails if the line is all spaces.


I use this script to remove blanks of beginning of a line.

To remove blanks from a text (with paragraphs) then:


set t to "      "
set t to characters of t
if (count of t) > 0 then repeat while (contents of item 1 of t) is space
	set t to rest of t
	if (count of t) = 0 then exit repeat --- if you want to keep the space
	--then change =0 to =1
end repeat
t as string


Deivy Petrescu
email@hidden



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

References: 
 >Trim space chars from start of line (From: "Zavatone, Alex" <email@hidden>)
 >Re: Trim space chars from start of line (From: KOENIG Yvan <email@hidden>)
 >Re: Trim space chars from start of line (From: Deivy Petrescu <email@hidden>)
 >Re: Trim space chars from start of line (From: "Zavatone, Alex" <email@hidden>)

  • Prev by Date: Re: Trim space chars from start of line
  • Next by Date: Re: Trim space chars from start of line
  • Previous by thread: Re: Trim space chars from start of line
  • Next by thread: Re: Trim space chars from start of line
  • Index(es):
    • Date
    • Thread