Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: deleting text



On Nov 25, 2003, at 11:51 AM, Ruby Madraswala wrote:

I have text files (over 60 to 200 paragraphs). I am trying to write a script to delete the "\" always in front of a word and "|" (pipe) at end of a word. "\" and "|" can be at beginning and end of one word. Sounds simple but I can't get the delete statement to work. What am I missing here and am I using the wrong command and or wrong approach. (trying with the slash first). Can tell I am a beginner at scripting.

You are using the wrong approach. You can't delete characters from a string directly.

Try using text item delimiters; for example to remove the pipe, try this.

set applescript's text item delimiters to {"|"}
set wordlist to text items of File1Text
set applscript's text item delimiters to {""}
set File1Text to wordlist as text

Then repeat that with the slash, keeping in mind the special handling that a slash needs.

--Michelle

--
If you're not going somewhere, you're not getting anywhere.
_______________________________________________
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.

References: 
 >deleting text (From: "Ruby Madraswala" <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.