るりまサーチ

最速Rubyリファレンスマニュアル検索!
11件ヒット [1-11件を表示] (0.060秒)
トップページ > クエリ:l[x] > クエリ:>[x] > クエリ:guess[x] > ライブラリ:nkf[x]

別のキーワード

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

検索結果

NKF (38.0)

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

...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[...
...ile line = ARGF.gets
print NKF.nkf(opt, line)
end
//}

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

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

require 'nkf'

CODES = {
NKF
::JIS => "JIS",
NKF
::EUC => "EUC",
NKF
::SJIS => "SJIS",
NKF
::UTF8 => "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
//}

=== オプション文字列

-b...