html - how to select a some characters from string in javascript -


मेरे पास एक url स्ट्रिंग है जैसे "example.com/apps/visitor/visitscanner", "example.com/Apps/Seatings / Visitcanner

मैं उपरोक्त उदाहरण url के लिए "" "

के बाद निर्देशिका का नाम चुनना चाहता हूं, अगर मेरी यूआरएल स्ट्रिंग यह एक है, तो परिणाम" विज़िटर "।

मैं जावास्क्रिप्ट में यह कैसे कर सकता हूं?

आप उपयोग कर सकते हैं, जैसे:

  var str = "example.com/Apps/Visitor/visitscanner"; Var भागों = str.split ('/'); Console.log (भागों [parts.length - 2]); // विज़िटर    

Comments

Popular posts from this blog

php - how to change mysql_result($res, 0, "url"); to mysqli -

c# - How to clone a HttpRequestMessage when the original request has Content? -

split - php explode string with Uppercase if lowercase letter exists before it without space -