JavaScript - Split A String

前端 未结 3 1884
别跟我提以往
别跟我提以往 2021-01-11 14:36

I have a variable that holds the value \'website.html\'.

How can I split that variable so it only gives me the \'website\'?

Thanks

3条回答
  •  执笔经年
    2021-01-11 15:00

    String[] splitString = "website.html".split(".");
    String prefix = splitString[0];
    

    *Edit, I could've sworn you put Java not javascript

    var splitString = "website.html".split(".");
    var prefix = splitString[0];
    

提交回复
热议问题