193件ヒット
[101-193件を表示]
(0.010秒)
ライブラリ
- ビルトイン (193)
キーワード
- byterindex (3)
- bytesize (12)
- byteslice (36)
- bytesplice (10)
-
each
_ byte (24) - getbyte (12)
- scrub (36)
- scrub! (36)
検索結果
先頭5件
-
String
# scrub! {|bytes| . . . } -> String (115.0) -
self が不正なバイト列を含む場合に別の文字列に置き換えます。常に self を返します。
...ロックの戻り値で置き換えられます。
//emlist[例][ruby]{
"abc\u3042\x81".scrub! # => "abc\u3042\uFFFD"
"abc\u3042\x81".scrub!("*") # => "abc\u3042*"
"abc\u3042\xE3\x80".scrub!{|bytes| '<'+bytes.unpack('H*')[0]+'>' } # => "abc\u3042<e380>"
//}
@see String#scrub... -
String
# byterindex(pattern , offset = self . bytesize) -> Integer | nil (102.0) -
文字列のバイト単位のインデックス offset から左に向かって pattern を探索します。 最初に見つかった部分文字列の左端のバイト単位のインデックスを返します。 見つからなければ nil を返します。
...は正規表現で指定します。
offset が負の場合は、文字列の末尾から数えた位置から探索します。
byterindex と String#byteindex とでは、探索方向だけが逆になります。
完全に左右が反転した動作をするわけではありません。
探索......//emlist[String#byteindex の場合][ruby]{
p "stringstring".byteindex("ing", 1) # => 3
# ing # ここから探索を始める
# ing
# ing # 右にずらしていってここで見つかる
//}
//emlist[String#byterindex の場合][ruby]{
p "stringstring".byterinde......erindex('o', 0) # => nil
'foo'.byterindex('o', 1) # => 1
'foo'.byterindex('o', 2) # => 2
'foo'.byterindex('o', 3) # => 2
'foo'.byterindex('o', -1) # => 2
'foo'.byterindex('o', -2) # => 1
'foo'.byterindex('o', -3) # => nil
'foo'.byterindex('o', -4) # => nil
//}
@see String#rindex, String#byteindex... -
String
# scrub -> String (15.0) -
self が不正なバイト列を含む場合に別の文字列に置き換えた新しい文字列を返します。
...ブ
ロックの戻り値で置き換えられます。
//emlist[例][ruby]{
"abc\u3042\x81".scrub # => "abc\u3042\uFFFD"
"abc\u3042\x81".scrub("*") # => "abc\u3042*"
"abc\u3042\xE3\x80".scrub{|bytes| '<'+bytes.unpack('H*')[0]+'>' } # => "abc\u3042<e380>"
//}
@see String#scrub!... -
String
# scrub! -> String (15.0) -
self が不正なバイト列を含む場合に別の文字列に置き換えます。常に self を返します。
...ロックの戻り値で置き換えられます。
//emlist[例][ruby]{
"abc\u3042\x81".scrub! # => "abc\u3042\uFFFD"
"abc\u3042\x81".scrub!("*") # => "abc\u3042*"
"abc\u3042\xE3\x80".scrub!{|bytes| '<'+bytes.unpack('H*')[0]+'>' } # => "abc\u3042<e380>"
//}
@see String#scrub... -
String
# scrub!(repl) -> String (15.0) -
self が不正なバイト列を含む場合に別の文字列に置き換えます。常に self を返します。
...ロックの戻り値で置き換えられます。
//emlist[例][ruby]{
"abc\u3042\x81".scrub! # => "abc\u3042\uFFFD"
"abc\u3042\x81".scrub!("*") # => "abc\u3042*"
"abc\u3042\xE3\x80".scrub!{|bytes| '<'+bytes.unpack('H*')[0]+'>' } # => "abc\u3042<e380>"
//}
@see String#scrub... -
String
# scrub(repl) -> String (15.0) -
self が不正なバイト列を含む場合に別の文字列に置き換えた新しい文字列を返します。
...ブ
ロックの戻り値で置き換えられます。
//emlist[例][ruby]{
"abc\u3042\x81".scrub # => "abc\u3042\uFFFD"
"abc\u3042\x81".scrub("*") # => "abc\u3042*"
"abc\u3042\xE3\x80".scrub{|bytes| '<'+bytes.unpack('H*')[0]+'>' } # => "abc\u3042<e380>"
//}
@see String#scrub!... -
String
# each _ byte -> Enumerator (8.0) -
文字列の各バイトに対して繰り返します。
...文字列の各バイトに対して繰り返します。
//emlist[例][ruby]{
"str".each_byte do |byte|
p byte
end
# => 115
# => 116
# => 114
"あ".each_byte do |byte|
p byte
end
# => 227
# => 129
# => 130
//}
@see String#bytes... -
String
# each _ byte {|byte| . . . } -> self (8.0) -
文字列の各バイトに対して繰り返します。
...文字列の各バイトに対して繰り返します。
//emlist[例][ruby]{
"str".each_byte do |byte|
p byte
end
# => 115
# => 116
# => 114
"あ".each_byte do |byte|
p byte
end
# => 227
# => 129
# => 130
//}
@see String#bytes... -
String
# getbyte(index) -> Integer | nil (8.0) -
index バイト目のバイトを整数で返します。
...す。
範囲外を指定した場合は nil を返します。
@param index バイトを取り出す位置
//emlist[例][ruby]{
s = "tester"
s.bytes # => [116, 101, 115, 116, 101, 114]
s.getbyte(0) # => 116
s.getbyte(1) # => 101
s.getbyte(-1) # => 114
s.getbyte(6)...