summaryrefslogtreecommitdiff
path: root/node_modules/locutus/golang/strings/LastIndex.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/locutus/golang/strings/LastIndex.js')
-rw-r--r--node_modules/locutus/golang/strings/LastIndex.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/node_modules/locutus/golang/strings/LastIndex.js b/node_modules/locutus/golang/strings/LastIndex.js
new file mode 100644
index 0000000..2d793a6
--- /dev/null
+++ b/node_modules/locutus/golang/strings/LastIndex.js
@@ -0,0 +1,14 @@
+"use strict";
+
+module.exports = function LastIndex(s, sep) {
+ // discuss at: http://locutus.io/golang/strings/LastIndex
+ // original by: Kevin van Zonneveld (http://kvz.io)
+ // input by: GopherJS (http://www.gopherjs.org/)
+ // example 1: LastIndex('go gopher', 'go')
+ // returns 1: 3
+ // example 2: LastIndex('go gopher', 'rodent')
+ // returns 2: -1
+
+ return parseInt(s.lastIndexOf(sep), 10) >> 0;
+};
+//# sourceMappingURL=LastIndex.js.map \ No newline at end of file