Last active
September 5, 2017 21:14
-
-
Save masatoi/9cd88f0dcc09355443dba2659fd92535 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
| (ql:quickload :cl-unicode) | |
| (defun basic-ej-char? (symb) | |
| (or (eq symb 'CL-UNICODE-NAMES::HIRAGANA) | |
| (eq symb 'CL-UNICODE-NAMES::KATAKANA) | |
| (eq symb 'CL-UNICODE-NAMES::CJKUNIFIEDIDEOGRAPHS) | |
| (eq symb 'CL-UNICODE-NAMES::CJKSYMBOLSANDPUNCTUATION) | |
| (eq symb 'CL-UNICODE-NAMES::BASICLATIN))) | |
| (defun count-basic-ej-char (str) | |
| (loop for char across str | |
| count | |
| (multiple-value-bind (s symb) | |
| (cl-unicode:code-block char) | |
| (declare (ignore s)) | |
| (basic-ej-char? symb)))) | |
| (defun remove-not-basic-ej-char (str) | |
| (let ((result (make-string (count-basic-ej-char str))) | |
| (cnt 0)) | |
| (loop for char across str do | |
| (multiple-value-bind (s symb) | |
| (cl-unicode:code-block char) | |
| (declare (ignore s)) | |
| (when (basic-ej-char? symb) | |
| (setf (aref result cnt) char) | |
| (incf cnt)))) | |
| result)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment