Loading...

使用JavaScript的split函式完成字串切割

Temperature: 0 °C

Mark ChangMark Chang
author_tools

使用JavaScript的split 函式可以用來切割字串。

根據設定的切割點執行切開的動作。

以下範例:

var str = 'testvalue=aaa&bbb&ccc';
var NewArray = new Array();
var NewArray = str.split("&");
document.write("切割出來的第一個區塊是 " + NewArray[0] + '');//aaa
document.write("切割出來的第二個區塊是 " + NewArray[1]);//bbb
document.write("切割出來的第三個區塊是 " + NewArray[2]);//ccc

以上紀錄~
 

https://innstory.com/story-使用JavaScript的split函式完成字串切割-1899
javascript

Prev
 使用curl執行POST請求

Next
使用jQuery阻止input直接按Enter就送出表單 

About the Author

Mark Chang

離不開電腦的宅男

Visitor message

Leave some footprints to prove that you visited me

Recommended reading

Author's other related stories

php使用PDO獲取結果的方法

php使用PDO獲取結果的方...

fetch() 式例如下: mixed PDOStatement::fetch([int fetch...

如何將 a href 禁用

如何將 a href 禁用

如標題,若採用CSS的方式作法如下: .disabled { pointerevents: none...

在PHP強制顯示錯誤訊息的方法

在PHP強制顯示錯誤訊息的方...

若是單一檔案,只需要在每個PHP檔案裡添加下列行: iniset(&#;displayerrors&...

Please select an option

error

Hi, thank you for your participation, but you cannot vote repeatedly~

Join innstory now and start recording your story.

"Innstory" is a place to store stories. We are committed to becoming a warm platform. Deepening the bonds between people is our direction.
We are convinced that the blockchain between people is not just a cold calculation. Join us now.

Wrong format