Created
September 21, 2010 10:59
-
-
Save matsuda/589540 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class String | |
def half_spaceize | |
self.gsub(/\s| /, ' ') | |
end | |
def half_spaceize! | |
self.gsub!(/\s| /, ' ') | |
end | |
# '-ー‐-' => '-' | |
def hyphenize | |
self.gsub(/\xE3\x83\xBC|\xE2\x80\x90|\x2D/, "\xEF\xBC\x8D") | |
end | |
def hyphenize! | |
self.gsub!(/\xE3\x83\xBC|\xE2\x80\x90|\x2D/, "\xEF\xBC\x8D") | |
end | |
# '~~∼〜˜' => '~' | |
def tildeize | |
self.gsub(/\xE3\x80\x9C|\xE2\x88\xBC|\xCB\x9C|\x7E/, "\xEF\xBD\x9E") | |
end | |
def tildeize! | |
self.gsub!(/\xE3\x80\x9C|\xE2\x88\xBC|\xCB\x9C|\x7E/, "\xEF\xBD\x9E") | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment