4件ヒット
[1-4件を表示]
(0.057秒)
検索結果
-
MatchData (18076.0)
-
正規表現のマッチに関する情報を扱うためのクラス。
正規表現のマッチに関する情報を扱うためのクラス。
このクラスのインスタンスは、
* Regexp.last_match
* Regexp#match, String#match
* $~
などにより得られます。 -
Rinda
:: Template (202.0) -
タプルのマッチングのためのクラスです。 ユーザがこのクラスを直接使うことはありません。
タプルのマッチングのためのクラスです。
ユーザがこのクラスを直接使うことはありません。
=== 例
require 'rinda/rinda'
template = Rinda::Template.new(['abc', nil, nil])
template.match(['abc', 2, 5]) # => true
template.match(['hoge', 2, 5]) # => false
template = Rinda::Template.new([String, Integer, nil])
template.match(['abc', 2, 5... -
CSV (166.0)
-
このクラスは CSV ファイルやデータに対する完全なインターフェイスを提供します。
このクラスは CSV ファイルやデータに対する完全なインターフェイスを提供します。
=== 読み込み
//emlist[][ruby]{
require "csv"
csv_text = <<~CSV_TEXT
Ruby,1995
Rust,2010
CSV_TEXT
IO.write "sample.csv", csv_text
# ファイルから一行ずつ
CSV.foreach("sample.csv") do |row|
p row
end
# => ["Ruby", "1995"]
# ["Rust", "2010"]
# ファイルから一度に
p CSV.r... -
Regexp (40.0)
-
正規表現のクラス。正規表現のリテラルはスラッシュで囲んだ形式 で記述します。
正規表現のクラス。正規表現のリテラルはスラッシュで囲んだ形式
で記述します。
//emlist[][ruby]{
/^this is regexp/
//}
Regexp.new(string) を使って正規表現オブジェクトを動的に生成する
こともできます。
//emlist[][ruby]{
str = "this is regexp"
rp1 = Regexp.new("^this is regexp")
p rp1 =~ str # => 0
p Regexp.last_match[0] # => "this is regexp"
//}
spec/rege...