String.split

文字列を特定の値で分割する

構文

stringObject.split(separator, limit)

引数

separator=セパレータ, limit=区切り最大数

例文

<html>
<head>
<title>String.split</title>
</head>

<body>

<!--文字列を特定の値で分割するのサンプル-->
<script type="text/javascript">
var str="1 2 3 4 5";
document.write(str.split(" ")+"<br>");
document.write(str.split("")+"<br>");
document.write(str.split(" ", 3));
</script>

</body>
</html>

関連記事

スポンサーリンク

IN演算子 入っているか

ホームページ製作・web系アプリ系の製作案件募集中です。

上に戻る