Skip to content

Instantly share code, notes, and snippets.

@nahanil
Last active February 28, 2021 03:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nahanil/8704a97e1e3b89ba8af17fe3675ccbe0 to your computer and use it in GitHub Desktop.
Save nahanil/8704a97e1e3b89ba8af17fe3675ccbe0 to your computer and use it in GitHub Desktop.
Get a Chinese radical "by number"
/**
Get a Chinese radical "by number"
https://en.wikipedia.org/wiki/Kangxi_radical#Kangxi_Radicals_block
@param {uint8} idx positive integer
*/
function getRadicalByNumber(idx = 1) {
// oob check
if (idx < 1 || idx > 214) {
return ""
}
return String.fromCharCode(12031 + idx)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment