Change e letters to i in words: Difference between revisions
m
→{{header|AppleScript}}: →Core language: Different sort, tidy-up.
No edit summary |
m (→{{header|AppleScript}}: →Core language: Different sort, tidy-up.) |
||
Line 212:
</pre>
=={{header|AppleScript}}==
===Core language
<syntaxhighlight lang="applescript">use AppleScript version "2.3.1" -- Mac OS X 10.9 (Mavericks) or later.
use sorter : script "
use scripting additions
Line 226 ⟶ 224:
repeat until (l = r)
set m to (l + r) div 2
if (
set l to m + 1
else
Line 233 ⟶ 231:
end repeat
if (
return 0
end binarySearch
on replace(a, b, txt)
set astid to AppleScript's text item delimiters▼
set txt to txt's text items
set AppleScript's text item delimiters to b
set txt to txt as text
set AppleScript's text item delimiters to astid
return txt
end replace
on task(minWordLength)
Line 246 ⟶ 254:
set wordCount to (count o's wordList)
ignoring case
tell sorter to sort(o's wordList, 1, wordCount
▲ set astid to AppleScript's text item delimiters
repeat with i from wordCount to 1 by -1
if ((count thisWord) < minWordLength) then
else if ((thisWord contains "e") and (iWordCount > 0)) then
set
else if (
set beginning of o's
set iWordCount to iWordCount + 1
end if
▲ set iWordCount to iWordCount + 1
▲ end repeat
▲ set AppleScript's text item delimiters to astid
return o's output
Line 530 ⟶ 535:
victor <- vector
willis <- welles</pre>
=={{header|Arturo}}==
|