diff options
| author | unwox <me@unwox.com> | 2024-11-14 10:35:07 +0600 |
|---|---|---|
| committer | unwox <me@unwox.com> | 2024-11-14 10:38:53 +0600 |
| commit | f391e13ddb1fcd8a0a4daf033f341532060f7421 (patch) | |
| tree | efb82a9490976c5bc6e81bf3fda64a4e7093315a /lib/string.fnl | |
| parent | 032e9008f890847bb2a55b73762faaf690e1e154 (diff) | |
specify canonical URL for SEO
Diffstat (limited to 'lib/string.fnl')
| -rw-r--r-- | lib/string.fnl | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/string.fnl b/lib/string.fnl index 3e6134e..c722bd3 100644 --- a/lib/string.fnl +++ b/lib/string.fnl @@ -32,8 +32,9 @@ (fn ends-with [str end] (= (string.sub str (- (# end))) end)) -(fn trim [str] - (str:match "^%s*(.-)%s*$")) +(fn trim [str pattern] + (local pattern (or pattern "%s")) + (str:match (.. "^" pattern "*(.-)" pattern "*$"))) (fn truncate [str len ellipsis] (if (and (= (type str) "string") |
