How to split and slice a string in Handlebars?

Handlebars.registerHelper('splitUrl', function(url) {return url.split("/").slice(-1,str.length);});
var url = "https://twitter.com/akarshseggemu";
<p>{{splitUrl url}}</p>

--

--

--

Software Engineer - (Android, iOS and Unity) | M.Sc. Computer Science from Technische Universitaet Berlin | Mobile Advertising, attribution, monetisation

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Akarsh SEGGEMU

Akarsh SEGGEMU

Software Engineer - (Android, iOS and Unity) | M.Sc. Computer Science from Technische Universitaet Berlin | Mobile Advertising, attribution, monetisation

More from Medium

Make it right with good practices

CodeGirl to OT and Back to CodeGirl

Baby Steps to Understand The DOM

Demystifying Web Workers

Working of web worker