るりまサーチ

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

別のキーワード

  1. kernel $-l
  2. matrix l
  3. _builtin $-l
  4. lupdecomposition l
  5. l matrix

検索結果

<< < ... 3 4 5 >>

Encoding::Converter.asciicompat_encoding(encoding) -> Encoding | nil (3100.0)

同じ文字集合を持つ ASCII 互換エンコーディングを返します。

...ーディング名
@param encoding エンコーディングオブジェクト
@return ASCII 互換エンコーディングのオブジェクトか nil

引数とエンコーディングと同じ文字集合を持つ ASCII 互換エンコーディングを返します。引数と戻り値、2 つの...
...ングでない場合は nil を返します。

//emlist[][ruby]{
Encoding::Converter.asciicompat_encoding("ISO-2022-JP") #=> #<Encoding:stateless-ISO-2022-JP>
Encoding::Converter.asciicompat_encoding("UTF-16BE") #=> #<Encoding:UTF-8>
Encoding::Converter.asciicompat_encoding("UTF-8") #=> nil
//}...

Encoding::Converter.asciicompat_encoding(string) -> Encoding | nil (3100.0)

同じ文字集合を持つ ASCII 互換エンコーディングを返します。

...ーディング名
@param encoding エンコーディングオブジェクト
@return ASCII 互換エンコーディングのオブジェクトか nil

引数とエンコーディングと同じ文字集合を持つ ASCII 互換エンコーディングを返します。引数と戻り値、2 つの...
...ングでない場合は nil を返します。

//emlist[][ruby]{
Encoding::Converter.asciicompat_encoding("ISO-2022-JP") #=> #<Encoding:stateless-ISO-2022-JP>
Encoding::Converter.asciicompat_encoding("UTF-16BE") #=> #<Encoding:UTF-8>
Encoding::Converter.asciicompat_encoding("UTF-8") #=> nil
//}...

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

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

...peError 引数に nil を指定した場合に発生します。

//emlist[例][ruby]{
p Integer(4) #=> 4
p Integer(4_000) #=> 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...
...類は無視される
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 String#hex,String...

CSV::FieldInfo#index -> Integer (3006.0)

行内で何番目のフィールドかわかるゼロベースのインデックスを返します。

...るゼロベースのインデックスを返します。

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

csv = CSV.new("date1,date2\n2018-07-09,2018-07-10", headers: true)
csv.convert do |field,field_info|
p field_info.index
Date.parse(field)
end
p csv.first

# => 0
# => 1
# => #<CSV::Row "date1":#<Date:...

Encoding::InvalidByteSequenceError#error_bytes -> String (3006.0)

エラー発生時に捨てられたバイト列を返します。

...れたバイト列を返します。


//emlist[例][ruby]{
ec = Encoding::Converter.new("EUC-JP", "ISO-8859-1")
begin
ec.convert("abc\xA1\xFFdef")
rescue Encoding::InvalidByteSequenceError
p $!
#=> #<Encoding::InvalidByteSequenceError: "\xA1" followed by "\xFF" on EUC-JP>
puts $!.error_byte...
...s.dump #=> "\xA1"
puts $!.readagain_bytes.dump #=> "\xFF"
end
//}

@see Encoding::InvalidByteSequenceError#readagain_bytes...

絞り込み条件を変える

Kernel.#putc(ch) -> object (3006.0)

文字 ch を 標準出力 $stdout に出力します。

...きないオブジェクトを引数に
指定した場合に発生します。

//emlist[例][ruby]{
putc("ch")
putc(?c)
putc(99)
putc(355)
#=> cccc

putc(99.00) #=> c
putc(33333333333333333333333333333333333) # bignum too big to convert into `long' (RangeError)
//}

@see IO#putc...

Regexp#=~(string) -> Integer | nil (106.0)

文字列 string との正規表現マッチを行います。マッチした場合、 マッチした位置のインデックスを返します(先頭は0)。マッチしなかった 場合、あるいは string が nil の場合には nil を返 します。

...nil の場合には nil を返
します。

//emlist[例][ruby]{
p /foo/ =~ "foo" # => 0
p /foo/ =~ "afoo" # => 1
p /foo/ =~ "bar" # => nil
//}

組み込み変数 $~ もしくは Regexp.last_match にマッチに関する情報 MatchData が設定されます。

文字列のかわりにSymbol...
...nil でも String オブジェクト
でも Symbol でもない場合発生します。

//emlist[例][ruby]{
p /foo/ =~ "foo" # => 0
p Regexp.last_match(0) # => "foo"
p /foo/ =~ "afoo" # => 1
p $~[0] # => "foo"
p /foo/ =~ "bar" # => nil

unless...
.../foo/ === "bar"
puts "not match " # => not match
end

str = []
begin
/ugo/ =~ str
rescue TypeError
printf "! %s\t%s\n", $!, $@ # => ! can't convert Array into String r5.rb:15
end
//}...

ruby 1.8.2 feature (18.0)

ruby 1.8.2 feature ruby 1.8.2 での ruby 1.8.1 からの変更点です。

...: 拡張ライブラリ API
* [lib]: ライブラリ
*レベル
* [bug]: バグ修正
* [new]: 追加されたクラス/メソッドなど
* [compat]: 変更されたクラス/メソッドなど
* 互換性のある変更
* only backward-compatibility
* 影響の範囲が小...
...クラス/メソッドなど(互換性のない変更)
* [experimental]: 変更の中でも特に実験的なもの(将来再考して欲しいもの?)
* [obsolete]: 廃止された(される予定の)機能
* [platform]: 対応プラットフォームの追加

== 1.8.1 (2003-12-25) -> 1....
...以外では nil を 0 に変換しなくなりました。

$ ruby-1.8.1 -e 'p [nil].pack("L")'
"\000\000\000\000"

$ ruby-1.8.2 -e 'p [nil].pack("L")'
-e:1:in `pack': cannot convert nil into Integer (TypeError)
from -e:1

$ ruby-1.8.2 -e 'p [nil].pack("P")'...
<< < ... 3 4 5 >>