Created
May 9, 2012 16:11
-
-
Save kiy0taka/2646039 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
@Grab('com.ibm.icu:icu4j:4.8.1.1') | |
import com.ibm.icu.text.Transliterator | |
class StringCategory { | |
static hankaku = Transliterator.getInstance('Fullwidth-Halfwidth').&transliterate | |
static String div(String self, int divisor) { | |
divisor == 2 ? hankaku(self) : self | |
} | |
} | |
use (StringCategory) { | |
assert '這いよれ! ニャル子さん 4' / 2 == '這いよれ! ニャル子さん 4' | |
assert 'ABC' / 2 == 'ABC' | |
assert 'あ い う え お' / 2 == 'あ い う え お' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment