Created
April 8, 2014 09:30
-
-
Save samrayner/10104277 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on trim(theseCharacters, someText) | |
-- default values (all whitespace) | |
if theseCharacters is true then set theseCharacters to {" ", tab, ASCII character 10, return, ASCII character 0} | |
repeat until first character of someText is not in theseCharacters | |
set someText to text 2 thru -1 of someText | |
end repeat | |
repeat until last character of someText is not in theseCharacters | |
set someText to text 1 thru -2 of someText | |
end repeat | |
return someText | |
end trim |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Code fails when calling with a non empty string
trim(true, "")
of non-stringtrim(true,123)
.I fixed it in my fork, but no idea how to send a merge request...