Skip to content

Commit

Permalink
Merge pull request #2881 from hiropk/update_bytesplice_docs
Browse files Browse the repository at this point in the history
String#bytespliceの説明をruby3.3に合わせて更新
  • Loading branch information
znz authored May 10, 2024
2 parents de94eca + 6366cec commit d369d2d
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion refm/api/src/_builtin/String
Original file line number Diff line number Diff line change
Expand Up @@ -3690,9 +3690,20 @@ range で指定したバイトの範囲に含まれる部分文字列を返し
#@since 3.2
@see [[m:String#bytesplice]]
--- bytesplice(index, length, str) -> String
#@since 3.3
--- bytesplice(index, length, str, str_index, str_length) -> String
#@end
--- bytesplice(range, str) -> String
#@since 3.3
--- bytesplice(range, str, str_range) -> String
#@end

self の一部または全部を str で置き換えて self を返します。

self の一部または全部を str で置き換えて str を返します。
#@since 3.3
str_index と str_length もしくは str_range が与えられたとき、self の一部または全部を str.byteslice(str_index, str_length) もしくは str.byteslice(str_range) で置き換えます。
ただし、str の部分文字列は新しい文字列オブジェクトとして生成されません。
#@end

置き換え範囲の指定は、長さの指定が省略できないこと以外は
[[m:String#byteslice]] と同じです。
Expand All @@ -3701,7 +3712,14 @@ self の一部または全部を str で置き換えて str を返します。

@param index 置換したい文字列の範囲の始端
@param length 置換したい文字列の範囲の長さ
#@since 3.3
@param str_index str の範囲の始端
@param str_length str の範囲の長さ
#@end
@param range 置換したい文字列の範囲を示す Range オブジェクト
#@since 3.3
@param str_range str の範囲を示す Range オブジェクト
#@end
@raise IndexError index や length が範囲外の場合に発生
@raise RangeError range が範囲外の場合に発生
@raise IndexError 指定した始端や終端が文字列の境界と一致しない場合に発生
Expand Down

0 comments on commit d369d2d

Please sign in to comment.