Last active
December 15, 2015 18:59
-
-
Save peryaudo/5307799 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
#!/usr/bin/env ruby | |
your_class = 'ぬ' | |
hiragana = 'あいうえお' \ | |
'かきくけこ' \ | |
'さしすせそ' \ | |
'たちつてと' \ | |
'なにぬねの' \ | |
'はひふへほ' \ | |
'まみむめも' \ | |
'やゆよ' \ | |
'らりるれろ' \ | |
'わをん' | |
if ARGV.length < 1 then | |
print "argument required\n" | |
exit | |
end | |
is_included = false | |
if ARGV[0].length == 1 then | |
is_included = (ARGV[0] == your_class) | |
else | |
start = ARGV[0][0] | |
finish = ARGV[0][1] | |
selected = hiragana[hiragana.index(start) .. hiragana.index(finish)] | |
is_included = selected.include?(your_class) | |
end | |
print (is_included ? 'included' : '') + "\n" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment