るりまサーチ

最速Rubyリファレンスマニュアル検索!
81件ヒット [1-81件を表示] (0.026秒)
トップページ > クエリ:y[x] > クエリ:bytesize[x]

別のキーワード

  1. psych psych_y
  2. kernel y
  3. psych y
  4. kernel psych_y
  5. y kernel

ライブラリ

クラス

キーワード

検索結果

String#bytesize -> Integer (24207.0)

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

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

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

@see String#size...

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

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

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

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

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

//emlist[String#byterindex の場合][ruby]{
p "stringstring".byterindex("ing...
...][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'.byterindex(...

Encoding::Converter#primitive_convert(source_buffer, destination_buffer, destination_byteoffset, destination_bytesize) -> Symbol (308.0)

エンコーディング変換のためのメソッドの中で、もっとも細かな扱いが可能なメソッドです。

...格納するバッファ
@param destination_byteoffset 変換先バッファでのオフセット
@param destination_bytesize 変換先バッファの容量
@param options 変換の詳細を指定する定数やハッシュ
@return 変換結果を表す Symbol

options には以下が指定できま...
...# source buffer may be part of larger source
:after_output => true # stop conversion after output before input
: integer form
Encoding::Converter::PARTIAL_INPUT
Encoding::Converter::AFTER_OUTPUT

戻り値は以下のうちのどれかです。

* :invalid_byte_sequence
* :inc...
...ull
* :source_buffer_empty
* :finished

//emlist[][ruby]{
ec = Encoding::Converter.new("UTF-8", "EUC-JP")
src = "abc\x81あいう\u{20bb7}\xe3"
dst = ''

begin
ret = ec.primitive_convert(src, dst)
p [ret, src, dst, ec.primitive_errinfo]
case ret
when :invalid_byte_sequence
ec.insert_...

Encoding::Converter#primitive_convert(source_buffer, destination_buffer, destination_byteoffset, destination_bytesize, options) -> Symbol (308.0)

エンコーディング変換のためのメソッドの中で、もっとも細かな扱いが可能なメソッドです。

...格納するバッファ
@param destination_byteoffset 変換先バッファでのオフセット
@param destination_bytesize 変換先バッファの容量
@param options 変換の詳細を指定する定数やハッシュ
@return 変換結果を表す Symbol

options には以下が指定できま...
...# source buffer may be part of larger source
:after_output => true # stop conversion after output before input
: integer form
Encoding::Converter::PARTIAL_INPUT
Encoding::Converter::AFTER_OUTPUT

戻り値は以下のうちのどれかです。

* :invalid_byte_sequence
* :inc...
...ull
* :source_buffer_empty
* :finished

//emlist[][ruby]{
ec = Encoding::Converter.new("UTF-8", "EUC-JP")
src = "abc\x81あいう\u{20bb7}\xe3"
dst = ''

begin
ret = ec.primitive_convert(src, dst)
p [ret, src, dst, ec.primitive_errinfo]
case ret
when :invalid_byte_sequence
ec.insert_...

String.new(string = "", encoding: string.encoding, capacity: string.bytesize) -> String (207.0)

string と同じ内容の新しい文字列を作成して返します。 引数を省略した場合は空文字列を生成して返します。

...になります(ただし、string が指定されていなかった場合は
Encoding::ASCII_8BITになります)。
@param capacity 内部バッファのサイズを指定します。
指定することで、なんども文字列連結する
(そし...
...イト数が127未満であれば127、
それ以上であればstring.bytesizeになります。
@return 引数 string と同じ内容の文字列オブジェクト

//emlist[例][ruby]{
text = "hoge".encode("EUC-JP")
no_option = String.new(text)...
...# => "hoge"
no_option.encoding == Encoding::EUC_JP # => true
with_encoding = String.new(text, encoding: "UTF-8") # => "hoge"
with_encoding.encoding == Encoding::UTF_8 # => true
String.new("test", encoding: "UTF-8", capacity: 100_000) # => "test"
//}...

絞り込み条件を変える

Encoding::Converter#primitive_convert(source_buffer, destination_buffer) -> Symbol (108.0)

エンコーディング変換のためのメソッドの中で、もっとも細かな扱いが可能なメソッドです。

...格納するバッファ
@param destination_byteoffset 変換先バッファでのオフセット
@param destination_bytesize 変換先バッファの容量
@param options 変換の詳細を指定する定数やハッシュ
@return 変換結果を表す Symbol

options には以下が指定できま...
...# source buffer may be part of larger source
:after_output => true # stop conversion after output before input
: integer form
Encoding::Converter::PARTIAL_INPUT
Encoding::Converter::AFTER_OUTPUT

戻り値は以下のうちのどれかです。

* :invalid_byte_sequence
* :inc...
...ull
* :source_buffer_empty
* :finished

//emlist[][ruby]{
ec = Encoding::Converter.new("UTF-8", "EUC-JP")
src = "abc\x81あいう\u{20bb7}\xe3"
dst = ''

begin
ret = ec.primitive_convert(src, dst)
p [ret, src, dst, ec.primitive_errinfo]
case ret
when :invalid_byte_sequence
ec.insert_...

Encoding::Converter#primitive_convert(source_buffer, destination_buffer, destination_byteoffset) -> Symbol (108.0)

エンコーディング変換のためのメソッドの中で、もっとも細かな扱いが可能なメソッドです。

...格納するバッファ
@param destination_byteoffset 変換先バッファでのオフセット
@param destination_bytesize 変換先バッファの容量
@param options 変換の詳細を指定する定数やハッシュ
@return 変換結果を表す Symbol

options には以下が指定できま...
...# source buffer may be part of larger source
:after_output => true # stop conversion after output before input
: integer form
Encoding::Converter::PARTIAL_INPUT
Encoding::Converter::AFTER_OUTPUT

戻り値は以下のうちのどれかです。

* :invalid_byte_sequence
* :inc...
...ull
* :source_buffer_empty
* :finished

//emlist[][ruby]{
ec = Encoding::Converter.new("UTF-8", "EUC-JP")
src = "abc\x81あいう\u{20bb7}\xe3"
dst = ''

begin
ret = ec.primitive_convert(src, dst)
p [ret, src, dst, ec.primitive_errinfo]
case ret
when :invalid_byte_sequence
ec.insert_...

String.new(string = "", encoding: string.encoding, capacity: 127) -> String (107.0)

string と同じ内容の新しい文字列を作成して返します。 引数を省略した場合は空文字列を生成して返します。

...になります(ただし、string が指定されていなかった場合は
Encoding::ASCII_8BITになります)。
@param capacity 内部バッファのサイズを指定します。
指定することで、なんども文字列連結する
(そし...
...イト数が127未満であれば127、
それ以上であればstring.bytesizeになります。
@return 引数 string と同じ内容の文字列オブジェクト

//emlist[例][ruby]{
text = "hoge".encode("EUC-JP")
no_option = String.new(text)...
...# => "hoge"
no_option.encoding == Encoding::EUC_JP # => true
with_encoding = String.new(text, encoding: "UTF-8") # => "hoge"
with_encoding.encoding == Encoding::UTF_8 # => true
String.new("test", encoding: "UTF-8", capacity: 100_000) # => "test"
//}...

String.new(string = "", encoding: string.encoding, capacity: 63) -> String (107.0)

string と同じ内容の新しい文字列を作成して返します。 引数を省略した場合は空文字列を生成して返します。

...になります(ただし、string が指定されていなかった場合は
Encoding::ASCII_8BITになります)。
@param capacity 内部バッファのサイズを指定します。
指定することで、なんども文字列連結する
(そし...
...イト数が127未満であれば127、
それ以上であればstring.bytesizeになります。
@return 引数 string と同じ内容の文字列オブジェクト

//emlist[例][ruby]{
text = "hoge".encode("EUC-JP")
no_option = String.new(text)...
...# => "hoge"
no_option.encoding == Encoding::EUC_JP # => true
with_encoding = String.new(text, encoding: "UTF-8") # => "hoge"
with_encoding.encoding == Encoding::UTF_8 # => true
String.new("test", encoding: "UTF-8", capacity: 100_000) # => "test"
//}...