gpt4 book ai didi

javascript - 使用 Javascript 将链接更改为关键字

转载 作者:行者123 更新时间:2023-12-02 20:17:09 24 4
gpt4 key购买 nike

我想将网址文本更改为单词,但不知道该怎么做。请帮助我。

这就是我想要做的,例如:

some-text-url.html

进入

一些文本网址

最佳答案

使用分割方法:

var url = "some-text-url.html";
url = url.replace(".html", ""); // remove html
var words = url.split("-");

// words is now an array of the keywords

关于javascript - 使用 Javascript 将链接更改为关键字,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6097199/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com