るりまサーチ

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

別のキーワード

  1. argf.class lines
  2. argf.class each
  3. argf.class each_line
  4. argf.class gets
  5. argf.class to_a

ライブラリ

クラス

検索結果

ARGF.class#printf(format, *arg) -> nil (21129.0)

C 言語の printf と同じように、format に従い引数を 文字列に変換して処理対象のファイルに出力します。

...C 言語の printf と同じように、format に従い引数を
文字列に変換して処理対象のファイルに出力します。

c:ARGF#inplace時にのみ使用できます。
また $stdout への代入の影響を受けません。
それ以外は出力先を指定しない形式の K...

NKF (12.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...
...NARY => "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
//}

=== オプション文字列

-b 入...