Forum PHP 2025

Dom\CharacterData::replaceData

(PHP 8 >= 8.4.0)

Dom\CharacterData::replaceData 文字データの文字列の一部を置換する

説明

public Dom\CharacterData::replaceData(int $offset, int $count, string $data): void

位置 offset から count 文字ぶんのデータを、data に置換します。

パラメータ

offset

置換開始位置のオフセット。

count

置換する文字の数。 offsetcount の和が文字列の長さをこえている場合、データ末尾までのすべての データが置換されます。

data

置換する文字列。

戻り値

成功した場合に true を、失敗した場合に false を返します。

エラー / 例外

DOM_INDEX_SIZE_ERR

offset が負、 あるいは データ中の UTF-8 コードポイントの数より大きい場合、 または count が負の場合に発生します。

参考

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top