Last active
May 29, 2020 18:08
-
-
Save matheusmurta/72bba26b1353aa5cc854b3969a7bd3f8 to your computer and use it in GitHub Desktop.
Javascript get string after last slash
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let str = "http://localhost:8086/#/menu/user" | |
let index = str.lastIndexOf("/"); | |
result = str.substr(index+1); //result "user" | |
or | |
let last = str.split("/").pop(); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment