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, Unity) | M.Sc. Computer Science — Technische Universitaet Berlin | Mobile Advertising, Attribution, Monetisation, UA & Analytic

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, Unity) | M.Sc. Computer Science — Technische Universitaet Berlin | Mobile Advertising, Attribution, Monetisation, UA & Analytic

More from Medium

Countdown in Reactjs From Event’s Timezone and Date

Blind 75| Group Anagrams javascript solution (string sorting approach)

The curious case of React Refs

Handling Stale Closures and Accessing Latest State in React’s UseEffect.