如何在react native中使用javascript修剪以下URL?这是URL

https://economictimes.indiatimes.com/industry/banking/finance/banking/is-indias-current-banking-crisis-just-old-wine-in-a-new-bottle/articleshow/71451268.cms

我需要将其修整为economictimes.indiatimes.com

最佳答案

尝试这个。



url = "https://economictimes.indiatimes.com/industry/banking/finance/banking/is-indias-current-banking-crisis-just-old-wine-in-a-new-bottle/articleshow/71451268.cms"
var arr = url.split("/");
console.log(arr[2]);

关于javascript - 我如何在React Native中 trim URL,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/58832019/

10-12 17:57