156件ヒット
[1-100件を表示]
(0.171秒)
クラス
- Array (21)
-
Encoding
:: Converter (48) - Integer (24)
-
Psych
:: Nodes :: Stream (12) - String (51)
検索結果
先頭5件
-
Psych
:: Nodes :: Stream # encoding -> Integer (18309.0) -
stream に使われるエンコーディングを返します。
...stream に使われるエンコーディングを返します。
@see Psych::Nodes::Stream#encoding=... -
Integer
# chr(encoding) -> String (9290.0) -
self を文字コードとして見た時に、引数で与えたエンコーディング encoding に対応する文字を返します。
...ーディング encoding に対応する文字を返します。
//emlist[][ruby]{
p 65.chr
# => "A"
p 12354.chr
# => `chr': 12354 out of char range (RangeError)
p 12354.chr(Encoding::UTF_8)
# => "あ"
p 12354.chr(Encoding::EUC_JP)
# => RangeError: invalid codepoint 0x3042 in EUC-JP
//}
引数無......ばれた場合は self を US-ASCII、ASCII-8BIT、デフォルト内部エンコーディングの順で優先的に解釈します。
//emlist[][ruby]{
p 0x79.chr.encoding # => #<Encoding:US_ASCII>
p 0x80.chr.encoding # => #<Encoding:ASCII_8BIT>
//}
@param encoding エンコーディングを......表すオブジェクト。Encoding::UTF_8、'shift_jis' など。
@return 一文字からなる文字列
@raise RangeError self を与えられたエンコーディングで正しく解釈できない場合に発生します。
@see String#ord Encoding.default_internal... -
Integer
# chr -> String (9190.0) -
self を文字コードとして見た時に、引数で与えたエンコーディング encoding に対応する文字を返します。
...ーディング encoding に対応する文字を返します。
//emlist[][ruby]{
p 65.chr
# => "A"
p 12354.chr
# => `chr': 12354 out of char range (RangeError)
p 12354.chr(Encoding::UTF_8)
# => "あ"
p 12354.chr(Encoding::EUC_JP)
# => RangeError: invalid codepoint 0x3042 in EUC-JP
//}
引数無......ばれた場合は self を US-ASCII、ASCII-8BIT、デフォルト内部エンコーディングの順で優先的に解釈します。
//emlist[][ruby]{
p 0x79.chr.encoding # => #<Encoding:US_ASCII>
p 0x80.chr.encoding # => #<Encoding:ASCII_8BIT>
//}
@param encoding エンコーディングを......表すオブジェクト。Encoding::UTF_8、'shift_jis' など。
@return 一文字からなる文字列
@raise RangeError self を与えられたエンコーディングで正しく解釈できない場合に発生します。
@see String#ord Encoding.default_internal... -
Encoding
:: Converter # primitive _ convert(source _ buffer , destination _ buffer) -> Symbol (3161.0) -
エンコーディング変換のためのメソッドの中で、もっとも細かな扱いが可能なメソッドです。
...ッドです。
可搬性を確保しつつ、不正なバイトや変換先で未定義な文字の扱いを細かに指定したいときは、Encoding::Converter#primitive_convert が唯一の方法になります。
@param source_buffer 変換元文字列のバッファ
@param destination_buff......rce 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
* :incomplete......][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_output(ec.primitive_errinfo[3].dump[1..-2])
redo... -
Encoding
:: Converter # primitive _ convert(source _ buffer , destination _ buffer , destination _ byteoffset) -> Symbol (3161.0) -
エンコーディング変換のためのメソッドの中で、もっとも細かな扱いが可能なメソッドです。
...ッドです。
可搬性を確保しつつ、不正なバイトや変換先で未定義な文字の扱いを細かに指定したいときは、Encoding::Converter#primitive_convert が唯一の方法になります。
@param source_buffer 変換元文字列のバッファ
@param destination_buff......rce 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
* :incomplete......][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_output(ec.primitive_errinfo[3].dump[1..-2])
redo... -
Encoding
:: Converter # primitive _ convert(source _ buffer , destination _ buffer , destination _ byteoffset , destination _ bytesize) -> Symbol (3161.0) -
エンコーディング変換のためのメソッドの中で、もっとも細かな扱いが可能なメソッドです。
...ッドです。
可搬性を確保しつつ、不正なバイトや変換先で未定義な文字の扱いを細かに指定したいときは、Encoding::Converter#primitive_convert が唯一の方法になります。
@param source_buffer 変換元文字列のバッファ
@param destination_buff......rce 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
* :incomplete......][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_output(ec.primitive_errinfo[3].dump[1..-2])
redo... -
Encoding
:: Converter # primitive _ convert(source _ buffer , destination _ buffer , destination _ byteoffset , destination _ bytesize , options) -> Symbol (3161.0) -
エンコーディング変換のためのメソッドの中で、もっとも細かな扱いが可能なメソッドです。
...ッドです。
可搬性を確保しつつ、不正なバイトや変換先で未定義な文字の扱いを細かに指定したいときは、Encoding::Converter#primitive_convert が唯一の方法になります。
@param source_buffer 変換元文字列のバッファ
@param destination_buff......rce 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
* :incomplete......][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_output(ec.primitive_errinfo[3].dump[1..-2])
redo... -
Array
# pack(template) -> String (443.0) -
配列の内容を template で指定された文字列にしたがって、 バイナリとしてパックした文字列を返します。
...)
//emlist[][ruby]{
"\x01\xFE".unpack("c*") # => [1, -2]
[1, -2].pack("c*") # => "\x01\xFE"
[1, 254].pack("c*") # => "\x01\xFE"
//}
: C
unsigned char (8bit 符号なし整数)
//emlist[][ruby]{
"\x01\xFE".unpack("C*") # => [1, 254]
[1, -2].pack("C*") # => "\x01\xFE"
[1, 254].pack("C*") # =>......*") # => [513, -514]
[513, 65022].pack("s*") # => "\x01\x02\xFE\xFD"
[513, -514].pack("s*") # => "\x01\x02\xFE\xFD"
//}
ビッグエンディアン (SPARC64):
//emlist[][ruby]{
"\x01\x02\xFE\xFD".unpack("s*") # => [258, -259]
[258, 65277].pack("s*") # => "\x01\x02\xFE\xFD"
[258, -259].pack("s*......2].pack("s*") # => "\x01\x02\xFE\xFD"
[513, -514].pack("s*") # => "\x01\x02\xFE\xFD"
//}
ビッグエンディアン (SPARC64):
//emlist[][ruby]{
"\x01\x02\xFE\xFD".unpack("S*") # => [258, 65277]
[258, 65277].pack("S*") # => "\x01\x02\xFE\xFD"
[258, -259].pack("S*") # => "\x01\x02\xFE\xFD"
//... -
Array
# pack(template , buffer: String . new) -> String (443.0) -
配列の内容を template で指定された文字列にしたがって、 バイナリとしてパックした文字列を返します。
...)
//emlist[][ruby]{
"\x01\xFE".unpack("c*") # => [1, -2]
[1, -2].pack("c*") # => "\x01\xFE"
[1, 254].pack("c*") # => "\x01\xFE"
//}
: C
unsigned char (8bit 符号なし整数)
//emlist[][ruby]{
"\x01\xFE".unpack("C*") # => [1, 254]
[1, -2].pack("C*") # => "\x01\xFE"
[1, 254].pack("C*") # =>......*") # => [513, -514]
[513, 65022].pack("s*") # => "\x01\x02\xFE\xFD"
[513, -514].pack("s*") # => "\x01\x02\xFE\xFD"
//}
ビッグエンディアン (SPARC64):
//emlist[][ruby]{
"\x01\x02\xFE\xFD".unpack("s*") # => [258, -259]
[258, 65277].pack("s*") # => "\x01\x02\xFE\xFD"
[258, -259].pack("s*......2].pack("s*") # => "\x01\x02\xFE\xFD"
[513, -514].pack("s*") # => "\x01\x02\xFE\xFD"
//}
ビッグエンディアン (SPARC64):
//emlist[][ruby]{
"\x01\x02\xFE\xFD".unpack("S*") # => [258, 65277]
[258, 65277].pack("S*") # => "\x01\x02\xFE\xFD"
[258, -259].pack("S*") # => "\x01\x02\xFE\xFD"
//...