CharacterData: substringData() メソッド

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

substringData()CharacterData インターフェイスのメソッドで、既存のデータの一部を、指定した位置から始まり、指定した文字数分のデータを返します。

構文

js
  domString = characterData.substringData(offset, count)

引数

offset

返す部分文字列に含める最初の文字の位置です。 0 は文字列の最初の文字を表します。

count

返す文字数です。

返値

文字列型で部分文字列を返します。

例外

IndexSizeError DOMException

offset + count が内容のデータの長さよりも大きかった場合に発生します。

仕様書

Specification
DOM
# dom-characterdata-substringdata

ブラウザーの互換性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
substringData

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support