ykyk1218/unified_hyphen

View on GitHub
lib/unified_hyphen.rb

Summary

Maintainability
A
0 mins
Test Coverage
require "unified_hyphen/version"
module UnifiedHyphen
end
class String
  JA_HYPEN_PATTERN = /ー|−|―|-|‐|‑|–|—|ー/
  def unify_ja_hyphen(dst_string="-")
    self.gsub(JA_HYPEN_PATTERN, dst_string)
  end

  def unify_ja_hyphen!(dst_string="-")
    self.gsub!(JA_HYPEN_PATTERN, dst_string)
  end
end