第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

在字符串中的網(wǎng)址前面插入空格

在字符串中的網(wǎng)址前面插入空格

暮色呼如 2021-04-29 14:20:25
我有帶有網(wǎng)址的字符串。因此,當(dāng)用戶鍵入它時,我必須在url前面添加空間。這是字符串:Hello this my profilehttps://my_pforile and thishttps://my_profile2我需要如下所示的字符串:Hello this my profile https://my_pforile and this https://my_profile2誰能幫我怎么做?
查看完整描述

2 回答

?
幕布斯7119047

TA貢獻(xiàn)1794條經(jīng)驗(yàn) 獲得超8個贊

您可以使用String#replacemethod替換https://為空白前綴。

let str = 'Hello this my profilehttps://my_pforile and thishttps://my_profile2';


console.log(

  str.replace(/https:\/\//g, ' $&')

)


// or with positive look-ahead

console.log(

  str.replace(/(?=https:\/\/)/g, ' ')

)


查看完整回答
反對 回復(fù) 2021-05-20
?
動漫人物

TA貢獻(xiàn)1815條經(jīng)驗(yàn) 獲得超10個贊

這也可以工作,您可以使用join進(jìn)行字符串拆分


let str="Hello this my profilehttps://my_pforile and thishttps://my_profile2"


let newstring=str.split("profile").join("profile ");

console.log(newstring)


查看完整回答
反對 回復(fù) 2021-05-20
  • 2 回答
  • 0 關(guān)注
  • 263 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號