# File lib/jcode.rb, line 133 def tr!(from, to) return nil if from == "" return self.delete!(from) if to == "" pattern = TrPatternCache[from] ||= /[#{_regex_quote(from)}]/ if from[0] == ?^ last = /.$/.match(to)[0] self.gsub!(pattern, last) else h = HashCache[from + "1-0" + to] ||= expand_ch_hash(from, to) self.gsub!(pattern) do |c| h[c] end end end