September Morn Update

This commit is contained in:
Ingy döt Net 2019-09-12 10:33:56 -07:00
parent 4e2d22a71d
commit aac6731f2c
6856 changed files with 141342 additions and 21127 deletions

View file

@ -0,0 +1,23 @@
-- Handle multiple occurrences of a string for part 2
on offset of needle in haystack
local needle, haystack
if the needle is not in the haystack then return {}
set my text item delimiters to the needle
script
property N : needle's length
property t : {1 - N} & haystack's text items
end script
tell the result
repeat with i from 2 to (its t's length) - 1
set x to item i of its t
set y to item (i - 1) of its t
set item i of its t to (its N) + (x's length) + y
end repeat
items 2 thru -2 of its t
end tell
end offset
offset of "happy" in stringA --> {8, 44, 83, 110}