るりまサーチ

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

別のキーワード

  1. string b
  2. _builtin b
  3. b string
  4. b _builtin
  5. b

キーワード

検索結果

<< 1 2 3 ... > >>

String#to_sym -> Symbol (30313.0)

文字列に対応するシンボル値 Symbol を返します。

...値 Symbol を返します。

なお、このメソッドの逆にシンボルに対応する文字列を得るには
Symbol#to_s または Symbol#id2name を使います。

シンボル文字列にはヌルキャラクタ("\0")、空の文字列の使用も可能です。

//emlist[例][ruby]{
p...
..."foo".intern # => :foo
p "foo".intern.to_s == "foo" # => true
//}...

OpenSSL::BN#to_s(base=10) -> String (27487.0)

自身を表す文字列を返します。

...ます。

b
ase で、変換方法(基数)を指定します。
デフォルトは 10 で、他に 16, 2, 0 を指定できます。

10 10進数の表記
16 16進数の表記
2 big-endianの符号無し整数のバイナリ列
0 MPI形式の文字列(バイト列)

@param base 文字...
...SSL::BNError 変換に失敗した場合に発生します

//emlist[][ruby]{
require 'openssl'

p 10.to_bn.to_s # => "10"
p (-5).to_bn.to_s # => "-5"

p 0.to_bn.to_s(16) # => "0"
p 9.to_bn.to_s(16) # => "09"
p 10.to_bn.to_s(16) # => "0A"
p 16.to_bn.to_s(16) # => "10"
p 26.to_bn.to_s(16)...
...p 256.to_bn.to_s(16) # => "0100"

p 0.to_bn.to_s(2) # => ""
p 6.to_bn.to_s(2) # => "\x06"
p 7.to_bn.to_s(2) # => "\a"

p 0.to_bn.to_s(0) # => "\x00\x00\x00\x00"
p 6.to_bn.to_s(0) # => "\x00\x00\x00\x01\x06"
p 7.to_bn.to_s(0) # => "\x00\x00\x00\x01\a"
//}

反対に、文字列から OpenSSL::BN ク...

BigDecimal#to_s -> String (27371.0)

self を文字列に変換します (デフォルトは "0.xxxxxen" の形になります)。

...nteger または String で指定します。

//emlist[][ruby]{
require "bigdecimal"
B
igDecimal("1.23456").to_s # ==> "0.123456e1"
//}

引数 n に正の整数が指定されたときは、小数点で分けられる左右部分を、
それぞれ n 桁毎に空白で区切ります。

//emlist...
...[][ruby]{
require "bigdecimal"
B
igDecimal("0.1234567890123456789").to_s(10) # => "0.1234567890 123456789e0"
//}

引数 n に正の整数を表す文字列を指定することもできます。

//emlist[][ruby]{
require "bigdecimal"
B
igDecimal("0.1234567890123456789").to_s("10") # => "0.12345678...
...きます。負の場合は常に '-' が付きます。

//emlist[][ruby]{
require "bigdecimal"
B
igDecimal("0.123456").to_s(" 3") # => " 0.123 456e0"
B
igDecimal("0.123456").to_s("+3") # => "+0.123 456e0"
B
igDecimal("-0.123456").to_s("3") # => "-0.123 456e0"
//}

さらに文字列の最後に指数...

BigDecimal#to_s(n) -> String (27371.0)

self を文字列に変換します (デフォルトは "0.xxxxxen" の形になります)。

...nteger または String で指定します。

//emlist[][ruby]{
require "bigdecimal"
B
igDecimal("1.23456").to_s # ==> "0.123456e1"
//}

引数 n に正の整数が指定されたときは、小数点で分けられる左右部分を、
それぞれ n 桁毎に空白で区切ります。

//emlist...
...[][ruby]{
require "bigdecimal"
B
igDecimal("0.1234567890123456789").to_s(10) # => "0.1234567890 123456789e0"
//}

引数 n に正の整数を表す文字列を指定することもできます。

//emlist[][ruby]{
require "bigdecimal"
B
igDecimal("0.1234567890123456789").to_s("10") # => "0.12345678...
...きます。負の場合は常に '-' が付きます。

//emlist[][ruby]{
require "bigdecimal"
B
igDecimal("0.123456").to_s(" 3") # => " 0.123 456e0"
B
igDecimal("0.123456").to_s("+3") # => "+0.123 456e0"
B
igDecimal("-0.123456").to_s("3") # => "-0.123 456e0"
//}

さらに文字列の最後に指数...

Object#to_s -> String (27321.0)

オブジェクトの文字列表現を返します。

...int や Kernel.#sprintf は文字列以外の
オブジェクトが引数に渡された場合このメソッドを使って文字列に変換し
ます。

//emlist[][ruby]{
class Foo
def initialize num
@num = num
end
end
it = Foo.new(40)

puts it #=> #<Foo:0x2b69110>

class Foo
def to_s...
..."Class:Foo Number:#{@num}"
end
end

puts it #=> Class:Foo Number:40
//}

@see Object#to_str,Kernel.#String...

絞り込み条件を変える

Thread::Backtrace::Location#to_s -> String (27309.0)

self が表すフレームを Kernel.#caller と同じ表現にした文字列を返し ます。

...

//emlist[例][ruby]{
# foo.rb
class Foo
attr_accessor :locations
def initialize(skip)
@locations = caller_locations(skip)
end
end

Foo.new(0..2).locations.map do |call|
puts call.to_s
end

# => path/to/foo.rb:5:in `initialize'
# path/to/foo.rb:9:in `new'
# path/to/foo.rb:9:in `<main...

WEBrick::HTTPResponse#to_s -> String (27309.0)

実際にクライアントに送られるデータを文字列として返します。

...列として返します。

require 'webrick'
include WEBrick
res = HTTPResponse.new( { :HTTPVersion => "1.1" } )
res.body = 'hoge'
print res.to_s

#=> 出力結果
HTTP/1.1 200 OK
Connection: Keep-Alive
Date: Sat, 27 Oct 2007 08:58:49 GMT
Server:
Content-Length: 4

hoge...

WEBrick::HTTPVersion#to_s -> String (27309.0)

自身を文字列に変換して返します。

...自身を文字列に変換して返します。

require 'webrick'
v = WEBrick::HTTPVersion.new('1.1')
p v.to_s #=> "1.1"...

Benchmark::Tms#to_s -> String (27303.0)

引数を省略して Benchmark::Tms#format を呼び出すのと同じです。

...引数を省略して Benchmark::Tms#format を呼び出すのと同じです。...
<< 1 2 3 ... > >>