首页
/
每日頭條
/
科技
/
js如何将字符串數組轉為字符串
js如何将字符串數組轉為字符串
更新时间:2025-04-18 06:51:28

js如何将字符串數組轉為字符串?1.js字符串替換多個相同對象替換方法,下面我們就來說一說關于js如何将字符串數組轉為字符串?我們一起去了解并探讨一下這個問題吧!

js如何将字符串數組轉為字符串(js的字符串替換多個相同對象替換方法)1

js如何将字符串數組轉為字符串

1.js字符串替換多個相同對象替換方法

str='a-b-c' 把上述文字的字符串的多個“-”替換為空 str.replace(/-/g,"") 

2.字符串轉數組

var str ="上海@上海市@闵行區@吳中路"; var splitAdd = str.split("@"); console.log(splitAdd) // ["上海", "上海市", "闵行區", "吳中路"]

,
Comments
Welcome to tft每日頭條 comments! Please keep conversations courteous and on-topic. To fosterproductive and respectful conversations, you may see comments from our Community Managers.
Sign up to post
Sort by
Show More Comments
Copyright 2023-2025 - www.tftnews.com All Rights Reserved