Skip to content

Instantly share code, notes, and snippets.

@cesare
Created March 27, 2012 09:31
Show Gist options
  • Save cesare/2214374 to your computer and use it in GitHub Desktop.
Save cesare/2214374 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
class String
def &(other)
self.unpack("U*").zip(other.to_s.unpack("U*")).map{|pair| pair.first & pair.last }.pack("U*")
end
end
puts "生" & "死"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment