Skip to content

sort Japanese Kana strings by JIS X 4061 order in Ruby

License

Notifications You must be signed in to change notification settings

emasaka/sort_kana_jisx4061

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SortKanaJisx4061

Sort Japanese Kana strings by JIS X 4061 (日本語文字列照合順番) order in Ruby.

Usage

require 'sort_kana_jisx4061'

words = [
  { original: '春', yomi: 'ハル' },
  { original: '夏', yomi: 'ナツ' },
  { original: '秋', yomi: 'アキ' },
  { original: '冬', yomi: 'フユ' },
]

words_sorted = sort_kana_jisx4061_by(words) {|x| x[:yomi] }
# => [{:original=>"秋", :yomi=>"アキ"}, {:original=>"夏", :yomi=>"ナツ"}, {:original=>"春", :yomi=>"ハル"}, {:original=>"冬", :yomi=>"フユ"}]

Note

  • Strings are exptected to be UTF-8
  • Sorting Kanji is not supported
  • Hiragana is converted to Katakana internally

License

This software is released under the MIT License, see LICENSE.txt.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/emasaka/sort_kana_jisx4061 .

About

sort Japanese Kana strings by JIS X 4061 order in Ruby

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages