Deprecated: Typecho\Widget\Request::getServer(): Implicitly marking parameter $default as nullable is deprecated, the explicit nullable type must be used instead in D:\PHP_HOME\www\gp_blog\var\Typecho\Widget\Request.php on line 219

Deprecated: Typecho\Request::getServer(): Implicitly marking parameter $default as nullable is deprecated, the explicit nullable type must be used instead in D:\PHP_HOME\www\gp_blog\var\Typecho\Request.php on line 349

Deprecated: Typecho\Widget\Response::goBack(): Implicitly marking parameter $suffix as nullable is deprecated, the explicit nullable type must be used instead in D:\PHP_HOME\www\gp_blog\var\Typecho\Widget\Response.php on line 158

Deprecated: Typecho\Widget\Response::goBack(): Implicitly marking parameter $default as nullable is deprecated, the explicit nullable type must be used instead in D:\PHP_HOME\www\gp_blog\var\Typecho\Widget\Response.php on line 158
JavaScript split() 方法 - 开发者

把一个字符串分割成字符串数组:

var str="How are you doing today?";
var n=str.split(" ");

n 输出一个数组的值:

How,are,you,doing,today?

定义和用法
split() 方法用于把一个字符串分割成字符串数组。
提示: 如果把空字符串 ("") 用作 separator,那么 stringObject 中的每个字符之间都会被分割。
注意: split() 方法不改变原始字符串。

语法

string.split(separator,limit)

标签: none

评论已关闭