るりまサーチ

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

別のキーワード

  1. _builtin -
  2. open-uri open
  3. irb/input-method new
  4. irb/input-method gets
  5. matrix -

検索結果

<< 1 2 > >>

Integer.try_convert(obj) -> Integer | nil (27372.0)

obj を Integer に変換しようと試みます。変換には Object#to_int メソッドが使われます。

...obj を Integer に変換しようと試みます。変換には Object#to_int
メソッドが使われます。

Integer
ならそのままobjを返します。
そうでなければ obj.to_int の結果を返すか、nil が返されます。

@param obj 変換する任意のオブジェクト...
...@return Integer または nil
@raise TypeError to_int が Integer を返さなかった場合に発生します。

//emlist[例][ruby]{
Integer
.try_convert(1) # => 1
Integer
.try_convert(1.25) # => 1
Integer
.try_convert([]) # => nil
//}...

Kernel.#Integer(arg, base = 0) -> Integer (18470.0)

引数を整数(Fixnum,Bignum)に変換した結果を返します。

...(Integerのサブクラス)を返さなかった場合に発生します。
@raise TypeError 引数に nil を指定した場合に発生します。

//emlist[例][ruby]{
p Integer(4) #=> 4
p Integer(4_000) #=> 4000
p Integer(9.88) #=> 9

p Integer(nil) # can't convert ni...
...l into Integer (TypeError)
p Integer(Object.new) # cannot convert Object into Integer (TypeError)

p Integer("10") #=> 10
p Integer("10", 2) #=> 2
p Integer("0d10") #=> 10
p Integer("010") #=> 8
p Integer("0o10") #=> 8
p Integer("0x10") #=> 16
p Integer("0b10") #=> 2
p...
...尾の空白類は無視される
p Integer("1\n0") # `Integer': invalid value for Integer: "1\n0" (ArgumentError)
p Integer("hoge") # `Integer': invalid value for Integer: "hoge" (ArgumentError)
p Integer("") # `Integer': invalid value for Integer: "" (ArgumentError)
//}

@see Strin...

Kernel.#Integer(arg, base = 0, exception: true) -> Integer | nil (18470.0)

引数を整数(Fixnum,Bignum)に変換した結果を返します。

...(Integerのサブクラス)を返さなかった場合に発生します。
@raise TypeError 引数に nil を指定した場合に発生します。

//emlist[例][ruby]{
p Integer(4) #=> 4
p Integer(4_000) #=> 4000
p Integer(9.88) #=> 9

p Integer(nil) # can't convert ni...
...l into Integer (TypeError)
p Integer(Object.new) # cannot convert Object into Integer (TypeError)

p Integer("10") #=> 10
p Integer("10", 2) #=> 2
p Integer("0d10") #=> 10
p Integer("010") #=> 8
p Integer("0o10") #=> 8
p Integer("0x10") #=> 16
p Integer("0b10") #=> 2
p...
...尾の空白類は無視される
p Integer("1\n0") # `Integer': invalid value for Integer: "1\n0" (ArgumentError)
p Integer("hoge") # `Integer': invalid value for Integer: "hoge" (ArgumentError)
p Integer("") # `Integer': invalid value for Integer: "" (ArgumentError)
//}

@see Strin...

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

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

...搬性を確保しつつ、不正なバイトや変換先で未定義な文字の扱いを細かに指定したいときは、Encoding::Converter#primitive_convert が唯一の方法になります。

@param source_buffer 変換元文字列のバッファ
@param destination_buffer 変換先文字...
...uffer 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_inpu...
...y]{
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
whe...

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

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

...搬性を確保しつつ、不正なバイトや変換先で未定義な文字の扱いを細かに指定したいときは、Encoding::Converter#primitive_convert が唯一の方法になります。

@param source_buffer 変換元文字列のバッファ
@param destination_buffer 変換先文字...
...uffer 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_inpu...
...y]{
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
whe...

絞り込み条件を変える

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

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

...搬性を確保しつつ、不正なバイトや変換先で未定義な文字の扱いを細かに指定したいときは、Encoding::Converter#primitive_convert が唯一の方法になります。

@param source_buffer 変換元文字列のバッファ
@param destination_buffer 変換先文字...
...uffer 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_inpu...
...y]{
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
whe...

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

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

...搬性を確保しつつ、不正なバイトや変換先で未定義な文字の扱いを細かに指定したいときは、Encoding::Converter#primitive_convert が唯一の方法になります。

@param source_buffer 変換元文字列のバッファ
@param destination_buffer 変換先文字...
...uffer 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_inpu...
...y]{
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
whe...

CSV::Converters -> Hash (6236.0)

このハッシュは名前でアクセスできる組み込みの変換器を保持しています。

...きる組み込みの変換器を保持しています。

CSV#convert で使用する変換器として使用できます。
また CSV.new のオプションとして使用することもできます。

: :integer
Kernel.#Integer を使用してフィールドを変換します。
: :float
Ke...
...rnel.#Float を使用してフィールドを変換します。
: :numeric
:integer と :float の組み合わせです。
: :date
Date.parse を使用してフィールドを変換します。
: :date_time
DateTime.parse を使用してフィールドを変換します。
: :all
:date_time...
...変換器は、実際に変換する前にフィールドのデータの
文字エンコーディングを UTF-8 に変換します。そのデータの文字エンコーディング
を UTF-8 に変換出来なかった場合は、変換には失敗しますが、データは変更されません...

CSV#converters -> Array (6218.0)

現在の変換器のリストを返します。

...在の変換器のリストを返します。

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

csv = CSV.new("header1,header2\nrow1_1,row1_2", converters: CSV::Converters.keys)
csv.converters # => [:integer, :float, :integer, :float, :date, :date_time, :date_time, :integer, :float]
//}

@see CSV::Converters...

ruby 1.6 feature (5280.0)

ruby 1.6 feature ruby version 1.6 は安定版です。この版での変更はバグ修正がメイン になります。

...グ修正がメイン
になります。

((<stable-snapshot|URL:ftp://ftp.netlab.co.jp/pub/lang/ruby/stable-snapshot.tar.gz>)) は、日々更新される安定版の最新ソースです。

== 1.6.8 (2002-12-24) -> stable-snapshot

: 2003-01-22: errno

EAGAIN と EWOULDBLOCK が同じ値の...
...> ruby 1.6.7 (2002-03-01) [i586-linux]
"baz"
"foo"
=> -:2:in `[]=': string not matched (IndexError)
from -:2
ruby 1.6.7 (2002-07-30) [i586-linux]

: 2002-06-03 sprintf()

"%d" で引数を整数にするときに、((<組み込み関数/Integer>)) と同じ規...
...: Integer[nth]

大きな値のインデックスに対して例外が発生していました。
((<ruby-bugs-ja:PR#114>))

p(-1[10000000000])

=> -:1:in `[]': bignum too big to convert into `int' (RangeError)
from -:1
ruby 1.6.5 (2001-09-19) [i586-li...

絞り込み条件を変える

1.6.8から1.8.0への変更点(まとめ) (2550.0)

1.6.8から1.8.0への変更点(まとめ) * ((<1.6.8から1.8.0への変更点(まとめ)/インタプリタの変更>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加されたクラス/モジュール>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加されたメソッド>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加された定数>)) * ((<1.6.8から1.8.0への変更点(まとめ)/拡張されたクラス/メソッド(互換性のある変更)>)) * ((<1.6.8から1.8.0への変更点(まとめ)/変更されたクラス/メソッド(互換性のない変更)>)) * ((<1.6.8から1.8.0への変更点(まとめ)/文法の変更>)) * ((<1.6.8から1.8.0への変更点(まとめ)/正規表現>)) * ((<1.6.8から1.8.0への変更点(まとめ)/Marshal>)) * ((<1.6.8から1.8.0への変更点(まとめ)/Windows 対応>)) * ((<1.6.8から1.8.0への変更点(まとめ)/廃止された(される予定の)機能>)) * ((<1.6.8から1.8.0への変更点(まとめ)/ライブラリ>)) * ((<1.6.8から1.8.0への変更点(まとめ)/拡張ライブラリAPI>)) * ((<1.6.8から1.8.0への変更点(まとめ)/バグ修正>)) * ((<1.6.8から1.8.0への変更点(まとめ)/サポートプラットフォームの追加>))

...作はなくなりました)

$defout や $deferr に代入を行うと警告がでます。
(注:1.6 に $deferr はありません)
((<ruby-dev:20961>))

$stdin にオブジェクトを代入すると標準入力からの入力メソッド(gets 等)
はそのオブジェクトにメソ...
...リテラルの prefix として 0d が追加されました。
8進リテラルの prefix として 0 以外に 0o が追加されました。

Integer
(), String#to_i、String#oct もこの prefix を認識します。

: ((<メソッド引数の & 修飾|メソッド呼び出し/イテレー...
...ました。

p Float(nil)

=> ruby 1.6.7 (2002-03-01) [i586-linux]
0.0
=> -:1:in `Float': cannot convert nil into Float (TypeError)
from -:1
ruby 1.7.3 (2002-09-02) [i586-linux]

=== ARGF

: ((<ARGF#to_s|ARGF/to_s>)) [change]

結果...
<< 1 2 > >>