text
stringlengths 0
15.7k
| source
stringlengths 6
112
|
---|---|
t as text | +strings.applescript |
end __text__ | +strings.applescript |
on concat(t) | +strings.applescript |
__text__(t) | +strings.applescript |
on __class__(str as text) | +strings.applescript |
run script str & " as class" | +strings.applescript |
set str to text 1 thru 4 of (str & " ") | +strings.applescript |
run script "«class " & str & "» as class" | +strings.applescript |
end __class__ | +strings.applescript |
on tid:(d as list) | +strings.applescript |
if d = {} or d = {0} then | +strings.applescript |
set d to tids | +strings.applescript |
else if d's item 1 = null then | +strings.applescript |
set N to random number from 0.0 to 1.0E+9 | +strings.applescript |
set d's first item to N / pi | +strings.applescript |
set tids to my text item delimiters | +strings.applescript |
set my text item delimiters to d | +strings.applescript |
end tid: | +strings.applescript |
on tid(d) | +strings.applescript |
tid_(d) | +strings.applescript |
end tid | +strings.applescript |
to join by d as list given list:L as list | +strings.applescript |
tid(d) | +strings.applescript |
set t to L as text | +strings.applescript |
tid(0) | +strings.applescript |
to glue(t, d) | +strings.applescript |
join by d given list:L | +strings.applescript |
end glue | +strings.applescript |
on split at d as list given string:t as text | +strings.applescript |
set L to text items of t | +strings.applescript |
to unjoin(t, d) | +strings.applescript |
split at d given string:t | +strings.applescript |
end unjoin | +strings.applescript |
to unglue(t, d) | +strings.applescript |
end unglue | +strings.applescript |
on offset of needle in haystack | +strings.applescript |
local needle, haystack | +strings.applescript |
if the needle is not in the haystack then return {} | +strings.applescript |
tid(needle) | +strings.applescript |
property N : needle's length | +strings.applescript |
property t : {1 - N} & haystack's text items | +strings.applescript |
repeat with i from 2 to (its t's length) - 1 | +strings.applescript |
set x to item i of its t | +strings.applescript |
set y to item (i - 1) of its t | +strings.applescript |
set item i of its t to (its N) + (x's length) + y | +strings.applescript |
items 2 thru -2 of its t | +strings.applescript |
on hasPrefix from substrings as list given string:t as text | +strings.applescript |
local substrings, t | +strings.applescript |
script prefixes | +strings.applescript |
property list : substrings | +strings.applescript |
repeat with prefix in the list of prefixes | +strings.applescript |
if t starts with prefix ¬ | +strings.applescript |
then return true | +strings.applescript |
end hasPrefix | +strings.applescript |
on startsWith(t as text, substrings as list) | +strings.applescript |
local t, substrings | +strings.applescript |
hasPrefix from substrings given string:t | +strings.applescript |
end startsWith | +strings.applescript |
on rev(t as text) | +strings.applescript |
__text__(reverse of characters of t) | +strings.applescript |
end rev | +strings.applescript |
to uppercase(t as text) | +strings.applescript |
script capitalise | +strings.applescript |
property chars : characters of t | +strings.applescript |
to fn(x) | +strings.applescript |
tell (offset of x in lower) to if it ≠ {} ¬ | +strings.applescript |
then return upper's character it | +strings.applescript |
x's contents | +strings.applescript |
mapItems from chars of capitalise given handler:capitalise | +strings.applescript |
__text__(result) | +strings.applescript |
to lowercase(t as text) | +strings.applescript |
script decapitalise | +strings.applescript |
tell (offset of x in upper) to if it ≠ {} ¬ | +strings.applescript |
then return lower's character it | +strings.applescript |
mapItems from chars of decapitalise given handler:decapitalise | +strings.applescript |
to titlecase(t as text) | +strings.applescript |
script titlecase | +strings.applescript |
to fn(x, i, L) | +strings.applescript |
if i = 1 or item (i - 1) of L ¬ | +strings.applescript |
is in whitespace then ¬ | +strings.applescript |
return uppercase(x) | +strings.applescript |
lowercase(x) | +strings.applescript |
mapItems from chars of titlecase given handler:titlecase | +strings.applescript |
on substrings from t as text | +strings.applescript |
property result : {} | +strings.applescript |
to recurse thru s at i : 1 for N : 1 | +strings.applescript |
local i, N, s | +strings.applescript |
if N > length of s then ¬ | +strings.applescript |
return my result | +strings.applescript |
set j to i + N - 1 | +strings.applescript |
if j > length of s then | +strings.applescript |
recurse thru s for N + 1 | +strings.applescript |
__text__(items i thru j of s) | +strings.applescript |
set end of my result to result | +strings.applescript |
recurse thru s at i + 1 for N | +strings.applescript |
end recurse | +strings.applescript |
tell the result to recurse thru its chars | +strings.applescript |
end substrings | +strings.applescript |
on substr(t) | +strings.applescript |
substrings from t | +strings.applescript |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.