Skip to content

Instantly share code, notes, and snippets.

@peryaudo
Last active December 15, 2015 18:59
Show Gist options
  • Save peryaudo/5307799 to your computer and use it in GitHub Desktop.
Save peryaudo/5307799 to your computer and use it in GitHub Desktop.
「な〜ほ」に「ぬ」が含まれるか、みたいなのを判定する
#!/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