334件ヒット
[301-334件を表示]
(0.034秒)
クラス
-
ARGF
. class (144) - CSV (48)
- Object (12)
モジュール
- Kernel (36)
キーワード
-
$ FILENAME (12) -
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (12) -
NEWS for Ruby 2
. 0 . 0 (12) -
NEWS for Ruby 2
. 3 . 0 (10) - NKF (12)
- filename (12)
- fileno (12)
- filter (36)
- getbyte (12)
- getc (12)
- gets (12)
-
inplace
_ mode= (12) - lineno (12)
- new (12)
- path (12)
- readbyte (12)
- readchar (12)
- readline (12)
-
ruby 1
. 8 . 2 feature (12) -
ruby 1
. 9 feature (12) -
to
_ i (12) -
to
_ io (12) - 制御構造 (12)
検索結果
-
CSV
. filter(options = Hash . new) {|row| . . . } (24.0) -
このメソッドは CSV データに対して Unix のツール群のようなフィルタを構築 するのに便利です。
...行を全て output に書き込
みます。
@param input String か IO のインスタンスを指定します。
デフォルトは ARGF です。
@param output String か IO のインスタンスを指定します。
デフォルトは $stdout です。
@param optio......t name,age
1,taro,tanaka,20
2,jiro,suzuki,18
3,ami,sato,19
4,yumi,adachi,21
EOS
File.write('test.csv',content)
options = { headers: true, return_headers: true, write_headers: true }
CSV.filter(File.open("test.csv"), File.open("out.csv", "w"), options) do |row|
if row.header_row?
row << "full... -
NKF (24.0)
-
nkf(Network Kanji code conversion Filter, https://osdn.net/projects/nkf/) を Ruby から使うためのモジュールです。
...コマンドの例です。
//emlist[例][ruby]{
#!/usr/local/bin/ruby
require 'nkf'
opt = ''
opt = ARGV.shift if ARGV[0][0] == ?-
while line = ARGF.gets
print NKF.nkf(opt, line)
end
//}
以下は、漢字コード判別コマンドの例です。
//emlist[例][ruby]{
#!/usr/local/bin/ruby......=> "UTF8",
NKF::BINARY => "BINARY",
NKF::ASCII => "ASCII",
NKF::UNKNOWN => "UNKNOWN",
}
while file = ARGV.shift
str = open(file) {|io| io.gets(nil) }
printf "%-10s ", file
if str.nil?
puts "EMPTY"
else
puts CODES.fetch(NKF.guess(str))
end
end
//}
=== オプショ... -
CSV
. new(data , options = Hash . new) -> CSV (18.0) -
このメソッドは CSV ファイルを読み込んだり、書き出したりするために String か IO のインスタンスをラップします。
...d even if it occurs in a quoted field, assuming that you
would have the same line endings there. If none of those sequences is
found, +data+ is ARGF, Object::STDIN, Object::STDOUT, or
Object::STDERR, or the stream is only available for output, the default
$INPUT_RECORD_SEPARATOR ($/) is u......ruby]{
require "csv"
users =<<-EOS
id,first name,last name,age
1,taro,tanaka,20
2,jiro,suzuki,18
3,ami,sato,19
4,yumi,adachi,21
EOS
File.write("test.csv", users)
File.open("test.csv", "r") do |f|
csv = CSV.new(f, headers: true)
csv.class # => CSV
csv.first # => #<CSV::Row "id":"1" "first na...