• 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
Text Item Delimiter error
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Text Item Delimiter error


  • Subject: Text Item Delimiter error
  • From: email@hidden
  • Date: Sun, 18 Mar 2001 01:09:49 EST

I'm writing a search/replace handler and don't understand the results I'm
getting.


-----------------------
set someText to "_abcd_efg_hijk_lmnop_qrs_tuv_wx_yz_"

set thisSearch to "_"

set thisReplace to " "
--
--
set AppleScript's text item delimiters to thisSearch

set textItems to the text items in someText
--
*Case 1.a set searchedText to {}
*Case 2.a set searchedText to ""

repeat with iText from 1 to (count textItems)

set iTextItem to text item iText of someText
--
*Case 1.b set the end of searchedText to (iTextItem & thisReplace)
*Case 2.b set searchedText to (searchedText & iTextItem &
thisReplace)

end repeat
-----------------------

*Case 1.
searchedText is " _abcd _efg _hijk _lmnop _qrs _tuv _wx _yz _ "
--incorrect

*Case 2.
searchedText is " abcd efg hijk lmnop qrs tuv wx yz " --correct, but
----------

My first choice was Case 1, and I tried many variations of 'searchedText'
being a list but always got the same result. Won't Case 2.b start to eat up
memory when the text gets lengthy?


  • Follow-Ups:
    • Re: Text Item Delimiter error
      • From: JollyRoger <email@hidden>
    • Re: Text Item Delimiter error
      • From: "Mohamed Shams" <email@hidden>
    • Re: Text Item Delimiter error
      • From: Paul Berkowitz <email@hidden>
  • Prev by Date: Finder and the time
  • Next by Date: Excel - export to html
  • Previous by thread: Re: Finder and the time
  • Next by thread: Re: Text Item Delimiter error
  • Index(es):
    • Date
    • Thread