るりまサーチ

最速Rubyリファレンスマニュアル検索!
69件ヒット [1-69件を表示] (0.082秒)

別のキーワード

  1. _builtin to_s
  2. openssl to_der
  3. openssl to_s
  4. _builtin to_a
  5. openssl to_pem

ライブラリ

クラス

キーワード

検索結果

Pathname#split -> Array (18158.0)

File.split(self.to_s) と同じです。

...File.split(self.to_s) と同じです。

//emlist[例][ruby]{
require "pathname"

pathname = Pathname("/path/to/sample")
pathname.split # => [#<Pathname:/path/to>, #<Pathname:sample>]
//}

@see File.split...

BigDecimal#split -> [Integer, String, Integer, Integer] (18120.0)

BigDecimal 値を 0.xxxxxxx*10**n と表現したときに、 符号 (NaNのときは 0、それ以外は+1か-1になります)、 仮数部分の文字列("xxxxxxx")と、基数(10)、更に指数 n を配列で返します。

..."
a = BigDecimal("3.14159265")
f, x, y, z = a.split
//}

とすると、f = 1、x = "314159265"、y = 10、z = 1 になります。
従って、以下のようにする事で Float に変換することができます。

//emlist[][ruby]{
s = "0."+x
b = f*(s.to_f)*(y**z)
//}

@see BigDecimal#to_f...

BigDecimal#to_f -> Float (6114.0)

self の近似値を表す Float オブジェクトに変換します。

...self の近似値を表す Float オブジェクトに変換します。

仮数部や指数部の情報が必要な場合は、BigDecimal#split メソッドを利
用してください。

@see BigDecimal#split...

Array#pack(template) -> String (19.0)

配列の内容を template で指定された文字列にしたがって、 バイナリとしてパックした文字列を返します。

...0\x00\x00\x00\x00\x00"
["abc"].pack("P3") # => "\xA0\xEE\er\x84U\x00\x00"

["abc"].pack("P4") # => ArgumentError: too short buffer for P(3 for 4)
[""].pack("P") # => ArgumentError: too short buffer for P(0 for 1)
//}

: u

uuencodeされた文字列
//emlist[][ruby]{
[""].pack("u") #...
...ffffff].pack("U") # => "\xFD\xBF\xBF\xBF\xBF\xBF"
[0x80000000].pack("U") # => RangeError: pack(U): value out of range
[0,256,65536].pack("U3").b # => "\x00\xC4\x80\xF0\x90\x80\x80"

"\x00\xC4\x80\xF0\x90\x80\x80".unpack("U3") # => [0, 256, 6...
...換する例
//emlist[][ruby]{
"61 62 63 64 65 66".delete(' ').lines.pack('H*').unpack('C*')
# => [97, 98, 99, 100, 101, 102]

"61 62 63 64 65 66".split.collect {|c| c.hex}
# => [97, 98, 99, 100, 101, 102]
//}

: バイナリと16進数のpackでは長さ指定は生成されるバイト数ではな...

Array#pack(template, buffer: String.new) -> String (19.0)

配列の内容を template で指定された文字列にしたがって、 バイナリとしてパックした文字列を返します。

...0\x00\x00\x00\x00\x00"
["abc"].pack("P3") # => "\xA0\xEE\er\x84U\x00\x00"

["abc"].pack("P4") # => ArgumentError: too short buffer for P(3 for 4)
[""].pack("P") # => ArgumentError: too short buffer for P(0 for 1)
//}

: u

uuencodeされた文字列
//emlist[][ruby]{
[""].pack("u") #...
...ffffff].pack("U") # => "\xFD\xBF\xBF\xBF\xBF\xBF"
[0x80000000].pack("U") # => RangeError: pack(U): value out of range
[0,256,65536].pack("U3").b # => "\x00\xC4\x80\xF0\x90\x80\x80"

"\x00\xC4\x80\xF0\x90\x80\x80".unpack("U3") # => [0, 256, 6...
...換する例
//emlist[][ruby]{
"61 62 63 64 65 66".delete(' ').lines.pack('H*').unpack('C*')
# => [97, 98, 99, 100, 101, 102]

"61 62 63 64 65 66".split.collect {|c| c.hex}
# => [97, 98, 99, 100, 101, 102]
//}

: バイナリと16進数のpackでは長さ指定は生成されるバイト数ではな...

絞り込み条件を変える

String#unpack(template) -> Array (19.0)

Array#pack で生成された文字列を テンプレート文字列 template にしたがってアンパックし、 それらの要素を含む配列を返します。

...0\x00\x00\x00\x00\x00"
["abc"].pack("P3") # => "\xA0\xEE\er\x84U\x00\x00"

["abc"].pack("P4") # => ArgumentError: too short buffer for P(3 for 4)
[""].pack("P") # => ArgumentError: too short buffer for P(0 for 1)
//}

: u

uuencodeされた文字列
//emlist[][ruby]{
[""].pack("u") #...
...ffffff].pack("U") # => "\xFD\xBF\xBF\xBF\xBF\xBF"
[0x80000000].pack("U") # => RangeError: pack(U): value out of range
[0,256,65536].pack("U3").b # => "\x00\xC4\x80\xF0\x90\x80\x80"

"\x00\xC4\x80\xF0\x90\x80\x80".unpack("U3") # => [0, 256, 6...
...換する例
//emlist[][ruby]{
"61 62 63 64 65 66".delete(' ').lines.pack('H*').unpack('C*')
# => [97, 98, 99, 100, 101, 102]

"61 62 63 64 65 66".split.collect {|c| c.hex}
# => [97, 98, 99, 100, 101, 102]
//}

: バイナリと16進数のpackでは長さ指定は生成されるバイト数ではな...