From 8bc0aad4edd7e9d033870594f833b24af6a108e1 Mon Sep 17 00:00:00 2001 From: Scott Worley Date: Fri, 28 Feb 2014 09:32:51 -0800 Subject: [PATCH 1/1] I miss ${foo%bar} --- picsorter.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/picsorter.js b/picsorter.js index 70cd236..2f9df0c 100644 --- a/picsorter.js +++ b/picsorter.js @@ -16,6 +16,16 @@ var exposure = 20; var zoom = "sm/"; var input_index = -1; +function endsWith(str, suffix) { + return str.indexOf(suffix, str.length - suffix.length) !== -1; +} + +function stripFromEnd(str, suffix) { + if (endsWith(str, suffix)) { + return str.substr(0, str.length - suffix.length); + } + return str; +} function setpic() { if ("exposure" in picinfo[files[input_index]]) { -- 2.44.1