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–implode() 將陣列轉成字串

PHP–implode() ...

pexelsphoto 使用implode將陣列轉換成字串; $ar=array(&#;a&#;,&...

錯誤訊息Division by zero的解決方式

錯誤訊息Division b...

錯誤訊息Division by zero發生的原因是因為除數是導致的錯誤: 解決方式如下: ) 運行...

RPO(Relative Path Overwrite)相對路徑覆蓋攻擊

RPO(Relative P...

首先,先來用例子說明何謂「相對路徑」何謂「絕對路徑」。 例如你有一個網址為http://www.de...

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