Programmatically determine number of strokes in a Chinese character?

You mean, is it encoded somehow in the actual code point? No. There may well be a table somewhere you can find on the net (or create one) but it's not part of the Unicode mandate to store this sort of metadata.


In Python there is a library for that:

>>> from cjklib.characterlookup import CharacterLookup
>>> cjk = CharacterLookup('C')
>>> cjk.getStrokeCount(u'日')
4

Disclaimer: I wrote it


A little googling came up with Unihan.zip, a file published by the Unicode Consortium which contains several text files including Unihan_RadicalStrokeCounts.txt which may be what you want. There is also an online Unihan Database Lookup based on this data.