text
stringlengths 0
15.7k
| source
stringlengths 6
112
|
---|---|
set replacedText to replace(replacedText, " ", "%20")
|
string.applescript
|
set replacedText to replace(replacedText, "[", "%5B")
|
string.applescript
|
set replacedText to replace(replacedText, "]", "%5D")
|
string.applescript
|
set replacedText to replace(replacedText, "=", "%3D")
|
string.applescript
|
set replacedText to replace(replacedText, "|", "%7C")
|
string.applescript
|
set replacedText to replace(replacedText, "<", "%3C")
|
string.applescript
|
set replacedText to replace(replacedText, ">", "%3E")
|
string.applescript
|
set replacedText to replace(replacedText, "/", "%2F")
|
string.applescript
|
set replacedText to replace(replacedText, ":", "%3A")
|
string.applescript
|
set replacedText to replace(replacedText, "@", "%40")
|
string.applescript
|
set replacedText to replace(replacedText, "&", "%26")
|
string.applescript
|
set replacedText to replace(replacedText, "+", "%2b")
|
string.applescript
|
set replacedText to replace(replacedText, "'", "%27")
|
string.applescript
|
set replacedText to replace(replacedText, "\"", "%22")
|
string.applescript
|
set replacedText to replace(replacedText, "(", "%28")
|
string.applescript
|
set replacedText to replace(replacedText, ")", "%29")
|
string.applescript
|
set replacedText to replace(replacedText, "\\", "%5C")
|
string.applescript
|
set replacedText to replace(replacedText, ",", "%2C")
|
string.applescript
|
replacedText
|
string.applescript
|
end encodeUrl
|
string.applescript
|
on decodeUrl(theString as text)
|
string.applescript
|
set newString to replace(theString, "%0A", "
|
string.applescript
|
set newString to replace(theString, "%20", " ")
|
string.applescript
|
set newString to replace(newString, "%5B", "[")
|
string.applescript
|
set newString to replace(newString, "%5D", "]")
|
string.applescript
|
set newString to replace(newString, "%3D", "=")
|
string.applescript
|
set newString to replace(newString, "%7C", "|")
|
string.applescript
|
set newString to replace(newString, "%3C", "<")
|
string.applescript
|
set newString to replace(newString, "%3E", ">")
|
string.applescript
|
set newString to replace(newString, "%2F", "/")
|
string.applescript
|
set newString to replace(newString, "%3A", ":")
|
string.applescript
|
set newString to replace(newString, "%40", "@")
|
string.applescript
|
set newString to replace(newString, "%26", "&")
|
string.applescript
|
set newString to replace(newString, "%2b", "+")
|
string.applescript
|
set newString to replace(newString, "%27", "'")
|
string.applescript
|
set newString to replace(newString, "%22", "\"")
|
string.applescript
|
set newString to replace(newString, "%28", "(")
|
string.applescript
|
set newString to replace(newString, "%29", ")")
|
string.applescript
|
set newString to replace(newString, "%5C", "\\")
|
string.applescript
|
set newString to replace(newString, "%2C", ",")
|
string.applescript
|
newString
|
string.applescript
|
end decodeUrl
|
string.applescript
|
on formatNext(theString as text, theTokens as list)
|
string.applescript
|
format(theString, theTokens)
|
string.applescript
|
end formatNext
|
string.applescript
|
on formatClassic(theString as text, theTokens as list)
|
string.applescript
|
if class of theTokens is text then set theTokens to {theTokens}
|
string.applescript
|
set builtString to theString
|
string.applescript
|
repeat with nextToken in theTokens
|
string.applescript
|
set builtString to replaceFirst(builtString, "{}", nextToken as text)
|
string.applescript
|
return builtString
|
string.applescript
|
end formatClassic
|
string.applescript
|
on format(theString, theTokens)
|
string.applescript
|
if class of theTokens is not list then set theTokens to {theTokens}
|
string.applescript
|
if theTokens is {} then set theTokens to {{}}
|
string.applescript
|
set AppleScript's text item delimiters to "{}"
|
string.applescript
|
set AppleScript's text item delimiters to theTokens
|
string.applescript
|
set theListAsText to first item of theArray
|
string.applescript
|
repeat with i from 2 to number of items in theArray
|
string.applescript
|
set nextToken to item (i - 1) of theTokens
|
string.applescript
|
set theListAsText to theListAsText & nextToken & item i of theArray
|
string.applescript
|
return theListAsText
|
string.applescript
|
end format
|
string.applescript
|
on title(theWord)
|
string.applescript
|
ucase(first character of theWord) & rest of characters of theWord
|
string.applescript
|
end title
|
string.applescript
|
to lower(theText)
|
string.applescript
|
do shell script "echo '" & theText & "' | tr '[:upper:]' '[:lower:]'"
|
string.applescript
|
end lower
|
string.applescript
|
to upper(theText)
|
string.applescript
|
do shell script "echo '" & theText & "' | tr '[:lower:]' '[:upper:]'"
|
string.applescript
|
end upper
|
string.applescript
|
to ucase(theText)
|
string.applescript
|
upper(theText)
|
string.applescript
|
end ucase
|
string.applescript
|
on lcase(theText)
|
string.applescript
|
lower(theText)
|
string.applescript
|
end lcase
|
string.applescript
|
to repeatText(theText, ntimes)
|
string.applescript
|
repeat ntimes times
|
string.applescript
|
set theResult to theResult & theText
|
string.applescript
|
end repeatText
|
string.applescript
|
on split(theString, theDelimiter)
|
string.applescript
|
theArray
|
string.applescript
|
to splitWithTrim(theString as text, theDelimiter)
|
string.applescript
|
set theList to split(theString, theDelimiter)
|
string.applescript
|
set sanitized to {}
|
string.applescript
|
repeat with next in theList
|
string.applescript
|
set nextTrimmed to trim(next)
|
string.applescript
|
if nextTrimmed is not equal to "" then set end of sanitized to nextTrimmed
|
string.applescript
|
sanitized
|
string.applescript
|
end splitWithTrim
|
string.applescript
|
on join(aList, delimiter)
|
string.applescript
|
set retval to ""
|
string.applescript
|
repeat with i from 1 to (count of aList)
|
string.applescript
|
set retval to retval & item i of aList
|
string.applescript
|
if i is not equal to (count of aList) then set retval to retval & delimiter
|
string.applescript
|
return retval
|
string.applescript
|
on lastIndexOf(sourceText, substring)
|
string.applescript
|
if substring is missing value then return 0
|
string.applescript
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.