るりまサーチ

最速Rubyリファレンスマニュアル検索!
24件ヒット [1-24件を表示] (0.076秒)
トップページ > クエリ:String[x] > クエリ:b[x] > クエリ:bytesize[x] > 種類:インスタンスメソッド[x]

別のキーワード

  1. string []=
  2. string slice
  3. string slice!
  4. string []
  5. string gsub

ライブラリ

クラス

キーワード

検索結果

String#bytesize -> Integer (45214.0)

文字列のバイト長を整数で返します。

...文字列のバイト長を整数で返します。

//emlist[例][ruby]{
#coding:UTF-8
# 実行結果は文字コードによって異なります。
p "いろは".size #=> 3
p "いろは".bytesize #=> 9
//}

@see String#size...

String#byterindex(pattern, offset = self.bytesize) -> Integer | nil (27332.0)

文字列のバイト単位のインデックス offset から左に向かって pattern を探索します。 最初に見つかった部分文字列の左端のバイト単位のインデックスを返します。 見つからなければ nil を返します。

...列または正規表現で指定します。

offset が負の場合は、文字列の末尾から数えた位置から探索します。

b
yterindex と String#byteindex とでは、探索方向だけが逆になります。
完全に左右が反転した動作をするわけではありません...
...//emlist[String#byteindex の場合][ruby]{
p "stringstring".byteindex("ing", 1) # => 3
# ing # ここから探索を始める
# ing
# ing # 右にずらしていってここで見つかる
//}

//emlist[String#byterindex の場合][ruby]{
p "stringstring".byterindex...
...例][ruby]{
'foo'.byterindex('f') # => 0
'foo'.byterindex('o') # => 2
'foo'.byterindex('oo') # => 1
'foo'.byterindex('ooo') # => nil

'foo'.byterindex(/f/) # => 0
'foo'.byterindex(/o/) # => 2
'foo'.byterindex(/oo/) # => 1
'foo'.byterindex(/ooo/) # => nil

# 右でのマッチが優先
'foo'.byterind...

IO#write_nonblock(string, exception: true) -> Integer | :wait_writable (6336.0)

IO をノンブロッキングモードに設定し、string を write(2) システムコールで書き出します。

...string を write(2) システムコールで書き出します。

write(2) が成功した場合、書き込んだ長さを返します。
EAGAIN, EINTR などは例外 Errno::EXXX として呼出元に報告されます。

書き込んだバイト数(つまり返り値)は String#bytesize...
...no::EAGAIN、 Errno::EWOULDBLOCK である場合は、
その例外オブジェクトに IO::WaitWritable が Object#extend
されます。よって IO::WaitWritable を write_nonblock のリトライが必要
かの判定に用いることができます。

@param string 自身に書き込みた...
...列を指定します。

@param exception false を指定すると、書き込み時に Errno::EAGAIN、Errno::EWOULDBLOCK が発生
する代わりに :wait_writable を返します。

@raise IOError 自身が書き込み用にオープンされていなければ発生します...