Re: Trim space chars from start of line
Re: Trim space chars from start of line
- Subject: Re: Trim space chars from start of line
- From: "Zavatone, Alex" <email@hidden>
- Date: Mon, 25 Jul 2011 14:24:54 -0700
- Acceptlanguage: en-US
- Thread-topic: Trim space chars from start of line
Ahh, nice catch. It will ignore the string if the starting condition is " " for myText. Thanks.
On Jul 25, 2011, at 4:12 PM, Steve Mills wrote:
> On Jul 25, 2011, at 16:04:17, email@hidden wrote:
>
>> Nice catch. Here's the fix:
>>
>> on TrimSpacesFromStartOfLine(myText)
>> if length of myText > 1 then
>> repeat while length of myText > 1
>> if character 1 of myText is " " then
>> set myText to text 2 through end of myText
>> else
>> return myText
>> exit repeat
>> end if
>> end repeat
>> end if
>> end TrimSpacesFromStartOfLine
>
> Just wanted to point out a couple things. This will fail if the string is 1 char long. The "exit repeat" is unnecessary because the return forces an exit.
>
> --
> Steve Mills
> Drummer, Mac geek
>
> _______________________________________________
> 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
This email message and any attachments are for the sole use of the intended recipient(s) and may contain information that is proprietary to U.S. Foodservice, Inc and/or its subsidiaries or otherwise confidential or legally privileged. If you have received this message in error, please notify the sender by reply, and delete all copies of this message and any attachments. If you are the intended recipient you may use the information contained in this message and any files attached to this message only as authorized by U.S. Foodservice. Files attached to this message may only be transmitted using secure systems and appropriate means of encryption, and must be secured using the same level password and security protection with which the file was provided to you. Any unauthorized use, dissemination or disclosure of this message or it's attachments is strictly prohibited.
_______________________________________________
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