るりまサーチ

最速Rubyリファレンスマニュアル検索!
11件ヒット [1-11件を表示] (0.151秒)
トップページ > クエリ:-[x] > クエリ:r[x] > クエリ:print[x] > クエリ:open[x] > 種類:モジュール[x]

別のキーワード

  1. _builtin to_r
  2. open3 pipeline_r
  3. matrix elements_to_r
  4. fileutils cp_r
  5. fileutils rm_r

ライブラリ

検索結果

NKF (829.0)

nkf(Network Kanji code conversion Filter, https://osdn.net/projects/nkf/) を Ruby から使うためのモジュールです。

...(Network Kanji code conversion Filter, https://osdn.net/projects/nkf/) を
R
uby から使うためのモジュールです。

=== 使い方

以下は、漢字コード変換コマンドの例です。

//emlist[例][ruby]{
#!/usr/local/bin/ruby

r
equire '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

r
equire 'nkf'

CODES = {
NKF::JIS => "JIS",
NKF::EUC => "EUC",
NKF::SJIS => "SJIS",
NKF::UTF8 => "U...
...BINARY => "BINARY",
NKF::ASCII => "ASCII",
NKF::UNKNOWN => "UNKNOWN",
}

while file = ARGV.shift
str = open(file) {|io| io.gets(nil) }

print
f "%-10s ", file
if str.nil?
puts "EMPTY"
else
puts CODES.fetch(NKF.guess(str))
end
end
//}

=== オプション文字列

-
b...