I have a string path1/path2
I need to get the values of path1 and path2.
how can i do it?
And what about getting the same from such string http://www.somesite.com/#path1/path2?
Thanks
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The plain JavaScript String object has a
splitmethod.However, for the second case, it’s generally not a good idea to do your own URL parsing via string or regex hacking. URLs are more complicated than you think. If you have a
locationobject or an<a>element, you can reliably pick the parts of the URL out of it using theprotocol,host,port,pathname,searchandhashproperties.