るりまサーチ

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

別のキーワード

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

キーワード

検索結果

<< 1 2 3 ... > >>

OpenSSL::BN#to_s(base=10) -> String (21387.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)...
...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 (21271.0)

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

... String で指定します。

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

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

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

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

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

//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 (21271.0)

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

... String で指定します。

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

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

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

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

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

//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 (21221.0)

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

...使って文字列に変換し
ます。

//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 (21209.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 (21209.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:...

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

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

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

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

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

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

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

REXML::Attribute#to_s -> String (21203.0)

正規化された属性値を返します。

正規化された属性値を返します。

属性値の正規化については XML の仕様を参考にしてください。
<< 1 2 3 ... > >>