Skip to content

Instantly share code, notes, and snippets.

@mikesorae
Created March 16, 2014 17:33
Show Gist options
  • Save mikesorae/9586882 to your computer and use it in GitHub Desktop.
Save mikesorae/9586882 to your computer and use it in GitHub Desktop.
全角カナ→半角カナ
require 'nkf'
# 既存の半角は維持しつつ全角カナを半角に変換
ARGF.each do |line|
# -xを付けないと既存の半角カナが全角になるぽい
puts NKF.nkf('-xw -Z4', line)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment