るりまサーチ

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

別のキーワード

  1. socket int
  2. prime int_from_prime_division
  3. _builtin to_int
  4. mkmf convertible_int
  5. option int

ライブラリ

キーワード

検索結果

<< 1 2 3 ... > >>

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

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

...接頭辞を含む整数表現とみなせる文字列のみ
変換します。

数値と文字列以外のオブジェクトに対しては arg.to_int, arg.to_i を
この順に使用して変換します。

@param arg 変換対象のオブジェクトです。

@param base 基数として0か2...
...ソッド to_int, to_i を持たないオブジェクトを引数に指定したか、to_int, to_i
が整数(Integerのサブクラス)を返さなかった場合に発生します。
@raise TypeError 引数に nil を指定した場合に発生します。

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

p Integer(nil) # can't convert nil 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("0...

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

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

...接頭辞を含む整数表現とみなせる文字列のみ
変換します。

数値と文字列以外のオブジェクトに対しては arg.to_int, arg.to_i を
この順に使用して変換します。

@param arg 変換対象のオブジェクトです。

@param base 基数として0か2...
...ソッド to_int, to_i を持たないオブジェクトを引数に指定したか、to_int, to_i
が整数(Integerのサブクラス)を返さなかった場合に発生します。
@raise TypeError 引数に nil を指定した場合に発生します。

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

p Integer(nil) # can't convert nil 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("0...

Kernel#convertible_int(type, headers = nil, opts = nil) (6119.0)

Returns the convertible integer type of the given +type+. You may optionally specify additional +headers+ to search in for the +type+. _Convertible_ means actually same type, or typedefed from same type. If the +type+ is a integer type and _convertible_ type is found, following macros are passed as preprocessor constants to the compiler using the +type+ name, in uppercase. * 'TYPEOF_', followed by the +type+ name, followed by '=X' where 'X' is the found _convertible_ type name. * 'TYP2NUM' and 'NUM2TYP, where 'TYP' is the +type+ name in uppercase with replacing '_t' suffix with 'T', followed by '=X' where 'X' is the macro name to convert +type+ to +Integer+ object, and vice versa. For example, if foobar_t is defined as unsigned long, then convertible_int("foobar_t") would return "unsigned long", and define macros: #define TYPEOF_FOOBAR_T unsigned long #define FOOBART2NUM ULONG2NUM #define NUM2FOOBART NUM2ULONG

...Returns the convertible integer type of the given +type+. You may
optionally specify additional +headers+ to search in for the +type+.
_Convertible_ means actually same type, or typedefed from same type.

If the +type+ is a integer type and _convertible_ type is found,
following macros are p...
...'_t'
suffix with 'T', followed by '=X' where 'X' is the macro name to
convert +type+ to +Integer+ object, and vice versa.

For example, if foobar_t is defined as unsigned long, then
convertible_int("foobar_t") would return "unsigned long", and define
macros:

#define TYPEOF_FOOBAR_T un...

Kernel#convertible_int(type, headers = nil, opts = nil) { ... } (6119.0)

Returns the convertible integer type of the given +type+. You may optionally specify additional +headers+ to search in for the +type+. _Convertible_ means actually same type, or typedefed from same type. If the +type+ is a integer type and _convertible_ type is found, following macros are passed as preprocessor constants to the compiler using the +type+ name, in uppercase. * 'TYPEOF_', followed by the +type+ name, followed by '=X' where 'X' is the found _convertible_ type name. * 'TYP2NUM' and 'NUM2TYP, where 'TYP' is the +type+ name in uppercase with replacing '_t' suffix with 'T', followed by '=X' where 'X' is the macro name to convert +type+ to +Integer+ object, and vice versa. For example, if foobar_t is defined as unsigned long, then convertible_int("foobar_t") would return "unsigned long", and define macros: #define TYPEOF_FOOBAR_T unsigned long #define FOOBART2NUM ULONG2NUM #define NUM2FOOBART NUM2ULONG

...Returns the convertible integer type of the given +type+. You may
optionally specify additional +headers+ to search in for the +type+.
_Convertible_ means actually same type, or typedefed from same type.

If the +type+ is a integer type and _convertible_ type is found,
following macros are p...
...'_t'
suffix with 'T', followed by '=X' where 'X' is the macro name to
convert +type+ to +Integer+ object, and vice versa.

For example, if foobar_t is defined as unsigned long, then
convertible_int("foobar_t") would return "unsigned long", and define
macros:

#define TYPEOF_FOOBAR_T un...

Kernel.#print(*arg) -> nil (6101.0)

引数を順に標準出力 $stdout に出力します。引数が与えられない時には変数 $_ の値を出力します。

...た場合に発生します。

//emlist[例][ruby]{
print "Hello, world!"
print "Regexp is",/ant/
print nil
print "\n"
#=> Hello, world!Regexp is(?-mix:ant)

$_ = "input"
$, = "<and>"
$\ = "<end>\n"
print
print "AA","BB"
#=> input<end>
#=> AA<and>BB<end>
//}

@see Kernel.#puts,Kernel.#p,IO#print...

絞り込み条件を変える

Kernel.#printf(format, *arg) -> nil (6101.0)

C 言語の printf と同じように、format に従い引数を文字列に変 換して port に出力します。

...C 言語の printf と同じように、format に従い引数を文字列に変
換して port に出力します。

port を省略した場合は標準出力 $stdout に出力します。

引数を 1 つも指定しなければ何もしません。

Ruby における format 文字列の拡張...
...については
Kernel.#sprintfの項を参照してください。

@param port 出力先になるIO のサブクラスのインスタンスです。
@param format フォーマット文字列です。
@param arg フォーマットされる引数です。
@raise ArgumentError port を指定したの...
...011 ' 123'"
printf("%1$*2$s %2$d %1$s", "hello", 8) #=> " hello 8 hello"
printf("%1$*2$s %2$d", "hello", -8) #=> "hello -8"
printf("%+g:% g:%-g", 1.23, 1.23, 1.23) #=> "+1.23: 1.23:1.23"
printf("%u", -123) #=> "..4294967173"
//}

@see Kernel.#sprintf,IO#printf...

Kernel.#printf(port, format, *arg) -> nil (6101.0)

C 言語の printf と同じように、format に従い引数を文字列に変 換して port に出力します。

...C 言語の printf と同じように、format に従い引数を文字列に変
換して port に出力します。

port を省略した場合は標準出力 $stdout に出力します。

引数を 1 つも指定しなければ何もしません。

Ruby における format 文字列の拡張...
...については
Kernel.#sprintfの項を参照してください。

@param port 出力先になるIO のサブクラスのインスタンスです。
@param format フォーマット文字列です。
@param arg フォーマットされる引数です。
@raise ArgumentError port を指定したの...
...011 ' 123'"
printf("%1$*2$s %2$d %1$s", "hello", 8) #=> " hello 8 hello"
printf("%1$*2$s %2$d", "hello", -8) #=> "hello -8"
printf("%+g:% g:%-g", 1.23, 1.23, 1.23) #=> "+1.23: 1.23:1.23"
printf("%u", -123) #=> "..4294967173"
//}

@see Kernel.#sprintf,IO#printf...

Kernel.#sprintf(format, *arg) -> String (3107.0)

format 文字列を C 言語の sprintf と同じように解釈し、 引数をフォーマットした文字列を返します。

...rintf と同じように解釈し、
引数をフォーマットした文字列を返します。

@param format フォーマット文字列です。
@param arg フォーマットされる引数です。
@see Kernel.#printf,Time#strftime,Date.strptime

=== sprintf フォーマット

Ruby の sprint...
...f フォーマットは基本的に C 言語の sprintf(3)
のものと同じです。ただし、short や long などの C 特有の型に対する修飾子が
ないこと、2進数の指示子(%b, %B)が存在すること、sprintf のすべての方言をサ
ポートしていないこと(%': 3...
...うな表示をします。絶対値に符号を付けた形式
で出力するためには %+x、% x のように指定します。


以下は sprintf フォーマットの書式です。[] で囲まれた部分は省略可
能であることを示しています。

%[nth$][フラグ][幅][.精...

Kernel.#rand(max = 0) -> Integer | Float (107.0)

擬似乱数を発生させます。

...1.0 未満の実数を、正の整数の場合は 0 以上 max 未満の整数を返します。
それ以外の値を指定した場合は max.to_int の絶対値が指定されたものとして扱います。

二番目の形式では range で指定された範囲の値を返します。
range...
...を、少なくとも片方が実数の場合は実数を返します。
range に含まれる数が無い場合は nil を返します。

まだ Kernel.#srand が呼ばれていなければ自動的に呼び出します。

擬似乱数生成器として Random::DEFAULT を使用します。
...
...10) #=> 1 (0 から 9 までの整数。終端を含まない)
rand(1.0..1.5) #=> 1.1362963047752432 (1.0 以上 1.5 以下の実数)
rand(1.0...1.5) #=> 1.1382321275715483 (1.0 以上 1.5 未満の実数)
rand(1..0) #=> nil
//}

@see Kernel.#srand, Random#rand, Random...
...を、少なくとも片方が実数の場合は実数を返します。
range に含まれる数が無い場合は nil を返します。

まだ Kernel.#srand が呼ばれていなければ自動的に呼び出します。

擬似乱数生成器として Random クラスオブジェクトを使用...

Kernel.#rand(range) -> Integer | Float | nil (107.0)

擬似乱数を発生させます。

...1.0 未満の実数を、正の整数の場合は 0 以上 max 未満の整数を返します。
それ以外の値を指定した場合は max.to_int の絶対値が指定されたものとして扱います。

二番目の形式では range で指定された範囲の値を返します。
range...
...を、少なくとも片方が実数の場合は実数を返します。
range に含まれる数が無い場合は nil を返します。

まだ Kernel.#srand が呼ばれていなければ自動的に呼び出します。

擬似乱数生成器として Random::DEFAULT を使用します。
...
...10) #=> 1 (0 から 9 までの整数。終端を含まない)
rand(1.0..1.5) #=> 1.1362963047752432 (1.0 以上 1.5 以下の実数)
rand(1.0...1.5) #=> 1.1382321275715483 (1.0 以上 1.5 未満の実数)
rand(1..0) #=> nil
//}

@see Kernel.#srand, Random#rand, Random...
...を、少なくとも片方が実数の場合は実数を返します。
range に含まれる数が無い場合は nil を返します。

まだ Kernel.#srand が呼ばれていなければ自動的に呼び出します。

擬似乱数生成器として Random クラスオブジェクトを使用...

絞り込み条件を変える

<< 1 2 3 ... > >>