Created
February 21, 2012 11:56
-
-
Save syou6162/1876100 to your computer and use it in GitHub Desktop.
ClojureでJavaのUnicodeBlockを使って文字種を判定する方法について
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
;; see also http://java.sun.com/j2se/1.5.0/ja/docs/ja/api/java/lang/Character.UnicodeBlock.html | |
(import 'java.lang.Character$UnicodeBlock) | |
;; java.lang.Character$UnicodeBlock | |
(Character$UnicodeBlock/of \u3042) | |
;; #<UnicodeBlock HIRAGANA> | |
(map #(Character$UnicodeBlock/of %) "日本だ") | |
;; (#<UnicodeBlock CJK_UNIFIED_IDEOGRAPHS> #<UnicodeBlock CJK_UNIFIED_IDEOGRAPHS> #<UnicodeBlock HIRAGANA>) | |
(map #(= (Character$UnicodeBlock/of %) Character$UnicodeBlock/HIRAGANA) "日本だ") | |
;; (false false true) | |
(map #(Character$UnicodeBlock/of %) "ブログ") | |
;; (#<UnicodeBlock KATAKANA> #<UnicodeBlock KATAKANA> #<UnicodeBlock KATAKANA>) | |
;; Character$UnicodeBlock/KATAKANA | |
(map #(Character$UnicodeBlock/of %) "Japan") | |
;; (#<UnicodeBlock BASIC_LATIN> #<UnicodeBlock BASIC_LATIN> #<UnicodeBlock BASIC_LATIN> #<UnicodeBlock BASIC_LATIN> #<UnicodeBlock BASIC_LATIN>) | |
;; Character$UnicodeBlock/BASIC_LATIN | |
(map #(Character$UnicodeBlock/of %) ",.!?") | |
;; (#<UnicodeBlock BASIC_LATIN> #<UnicodeBlock BASIC_LATIN> #<UnicodeBlock BASIC_LATIN> #<UnicodeBlock BASIC_LATIN>) | |
;; むむ、これはちょっと問題か。。。 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment