String matching: Difference between revisions
m
→{{header|AppleScript}}
(→{{header|AppleScript}}: Added a functionally composed variant (defining offsets in terms of findindices)) |
|||
Line 197:
or, defining an '''offsets''' function in terms of a more general '''findIndices''':
<lang applescript>-- offsets :: String -> String -> [Int]
on offsets(needle, haystack)
script match
property mx : length of haystack
property
on |λ|(x, i, xs)
if mx ≥
needle =
else
false
Line 211 ⟶ 210:
end |λ|
end script
findIndices(match, haystack)
end offsets
|