AppleScript delimiters
How do I remove the last 3 text items?
My list is as follows:
{"Water", "Management", "in", "Ancient", "Greek", "Cities", "Jun", "1993", "pdf"}
I would like to remove the last 3 text item (e.g.: "Jun, "1993", and "pdf").
Here is my script so far:
set AppleScript's text item delimiters to ["USA."]
set stringToUse to "04.Oxford.University.Press.USA.Water.Mngt.in.Ancient.Greek.Cities.Jun.1993.pdf" as string
set stringUSA to last text item of stringToUse
set AppleScript's text item delimiters to ["."]
set pathNames to text item of stringUSA
return pathNames
As a general rule it’s important that:
- The number of text items in the list can be a variable
- The text items to be deleted are always the last three
Try: