在开发过程中,我们有时候需要对名字进行三笔定位来实现中国汉字的查找,如下方法是win平台上使用的的一个方法,希望对大家有所帮助。
static void GetLocalizerLetter(IN TCHAR *tName, OUT TCHAR *tLocalizerLetter, IN const long maxlen = 4)
{
#define MIN(X,Y) (((X)<=(Y))? (X):(Y))
#define MAX(X,Y) (((X)>=(Y))? (X):(Y))
const TCHAR hzcode[] =
{
'a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','b','b','b','b',
'b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b',
'b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b',
'b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b',
'b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b',
'b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c',
'c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c',
'c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c',
'c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c',
'c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c',
'c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c','c',
'c','c','c','c','c','c','c','c','c','c','c','c','c','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d',
'd','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d',
'd','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d',
'd','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d',
'd','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','e','e','e',
'e','e','e','e','e','e','e','e','e','e','e','e','e','e','e','e','e','e','e','f','f','f','f','f','f','f','f','f','f','f','f','f','f','f','f','f','f','f','f','f',
'f','f','f','f','f','f','f','f','f','f','f','f','f','f','f','f','f','f','f','f','f','f','f','f','f','f','f','f','f','f','f','f','f','f','f','f','f','f','f','f',
'f','f','f','f','f','f','f','f','f','f','f','f','f','f','f','f','f','f','f','f','f','f','f','f','f','f','f','f','f','f','f','f','f','f','f','f','f','f','f','f',
'f','f','f','f','f','f','f','f','f','f','f','f','f','f','f','f','f','f','f','f','f','f','f','f','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g',
'g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g',
'g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g',
'g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g',
'g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h',
'h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h',
'h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h',
'h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h',
'h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h','h',
'j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j',
'j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j',
'j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j',
'j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j',
'j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j',
'j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j',
'j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','j',
'j','j','j','j','j','j','j','j','j','j','j','j','j','j','j','k','k','k','k','k','k','k','k','k','k','k','k','k','k','k','k','k','k','k','k','k','k','k','k','k',
'k','k','k','k','k','k','k','k','k','k','k','k','k','k','k','k','k','k','k','k','k','k','k','k','k','k','k','k','k','k','k','k','k','k','k','k','k','k','k','k',
'k','k','k','k','k','k','k','k','k','k','k','k','k','k','k','k','k','k','k','k','k','k','k','k','k','k','k','k','k','k','k','k','k','k','k','l','l','l','l','l',
'l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l',
'l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l',
'l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l',
'l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l',
'l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l',
'l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l','l',
'l','l','l','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m',
'm','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m',
'm','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m',
'm','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','m','n','n','n','n','n','n',
'n','n','n','n','n','n','n','n','n','n','n','n','n','n','n','n','n','n','n','n','n','n','n','n','n','n','n','n','n','n','n','n','n','n','n','n','n','n','n','n',
'n','n','n','n','n','n','n','n','n','n','n','n','n','n','n','n','n','n','n','n','n','n','n','n','n','n','n','n','n','n','n','n','n','n','n','o','o','o','o','o',
'o','o','o','p','p','p','p','p','p','p','p','p','p','p','p','p','p','p','p','p','p','p','p','p','p','p','p','p','p','p','p','p','p','p','p','p','p','p','p','p',
'p','p','p','p','p','p','p','p','p','p','p','p','p','p','p','p','p','p','p','p','p','p','p','p','p','p','p','p','p','p','p','p','p','p','p','p','p','p','p','p',
'p','p','p','p','p','p','p','p','p','p','p','p','p','p','p','p','p','p','p','p','p','p','p','p','p','p','p','p','p','p','p','p','p','p','p','p','p','p','p','p',
'p','p','p','p','p','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q',
'q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q',
'q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q',
'q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q',
'q','q','r','r','r','r','r','r','r','r','r','r','r','r','r','r','r','r','r','r','r','r','r','r','r','r','r','r','r','r','r','r','r','r','r','r','r','r','r','r',
'r','r','r','r','r','r','r','r','r','r','r','r','r','r','r','r','r','r','r','r','r','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s',
's','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s',
's','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s',
's','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s',
's','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s',
's','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s',
's','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s',
's','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','t','t','t','t','t','t','t','t','t','t','t','t','t',
't','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t',
't','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t',
't','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t',
't','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','w','w','w','w','w','w','w','w','w','w','w','w','w','w','w','w','w',
'w','w','w','w','w','w','w','w','w','w','w','w','w','w','w','w','w','w','w','w','w','w','w','w','w','w','w','w','w','w','w','w','w','w','w','w','w','w','w','w',
'w','w','w','w','w','w','w','w','w','w','w','w','w','w','w','w','w','w','w','w','w','w','w','w','w','w','w','w','w','w','w','w','w','w','w','w','w','w','w','w',
'w','w','w','w','w','w','w','w','w','w','w','w','w','w','w','w','w','w','w','w','w','w','w','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x',
'x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x',
'x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x',
'x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x',
'x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x',
'x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x',
'x','x','x','x','x','x','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y',
'y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y',
'y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y',
'y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y',
'y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y',
'y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y',
'y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y',
'y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','z','z','z','z','z','z','z','z',
'z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z',
'z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z',
'z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z',
'z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z',
'z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z',
'z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z',
'z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z',
'z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','a','a','a','a','a',
'c','j','w','g','n','s','p','g','c','g','n','e','a','y','a','b','t','y','y','z','d','x','y','k','y','g','t','a','j','a','m','j','q','m','b','s','g','z','s','c',
'y','j','s','y','y','q','p','g','k','b','z','g','y','a','y','w','j','k','g','k','l','j','s','w','k','p','j','q','h','y','a','w','a','d','z','l','s','g','m','r',
'y','p','y','w','w','c','c','k','z','n','k','y','d','g','t','t','n','g','j','e','y','k','k','z','y','t','c','j','n','m','c','y','l','q','l','y','p','y','q','f',
'q','r','p','z','s','l','w','b','t','g','k','j','f','y','x','j','w','z','l','t','b','n','c','x','j','j','j','j','z','x','d','t','t','s','q','z','y','c','d','x',
'x','h','g','c','k','a','p','h','f','f','s','s','a','y','b','g','m','x','l','p','b','y','l','l','a','h','l','x','s','a','z','m','a','j','h','s','o','a','n','g',
'h','d','z','q','y','k','l','g','j','h','s','g','q','z','h','x','q','g','k','e','z','z','w','y','s','c','s','c','j','x','y','e','y','x','a','d','z','p','m','d',
's','s','m','z','j','z','q','j','y','z','c','a','j','a','w','q','j','b','d','z','b','x','g','z','n','z','c','p','w','h','k','x','h','q','k','m','w','f','b','p',
'b','y','d','t','j','z','z','k','q','h','y','l','y','g','x','f','p','t','y','j','y','y','z','p','s','z','l','f','c','h','m','q','s','h','g','m','x','x','s','x',
'j','a','a','d','c','s','b','b','q','b','e','f','s','j','y','h','w','w','g','z','k','p','y','l','q','b','g','l','d','l','c','d','t','n','m','a','y','d','d','k',
's','s','n','g','y','c','s','g','x','l','y','z','a','y','b','n','p','t','s','d','k','d','y','l','h','g','y','m','y','l','c','x','p','y','a','j','n','d','q','j',
'w','x','q','x','f','y','y','f','j','l','e','q','b','z','r','x','c','c','q','w','q','q','s','b','n','k','y','m','g','p','l','b','m','j','r','q','c','f','l','n',
'y','m','y','q','m','s','q','t','r','b','c','a','t','h','z','t','q','f','r','x','q','h','x','m','j','j','c','j','l','x','q','g','j','m','s','h','z','k','b','s',
'w','y','e','m','y','l','t','x','f','s','y','d','s','g','l','y','c','j','q','x','s','j','n','q','b','s','c','t','y','h','b','f','t','d','c','y','z','d','j','w',
'y','g','h','q','f','s','x','w','c','k','q','k','x','e','b','p','t','l','p','x','j','z','s','r','m','e','b','w','h','j','l','b','j','s','l','y','y','s','m','d',
'x','l','c','l','q','k','x','l','h','x','j','r','z','j','m','f','q','h','x','h','w','y','w','s','b','h','t','r','x','x','g','l','h','q','h','f','n','m','a','y',
'k','l','d','y','x','z','p','w','l','g','g','a','m','t','c','f','p','a','j','j','z','y','l','j','t','y','a','n','j','g','b','j','p','l','q','g','d','z','y','q',
'y','a','x','b','k','y','s','e','c','j','s','z','n','s','l','y','z','h','z','x','l','z','c','g','h','p','x','z','h','z','n','y','t','d','s','b','c','j','k','d',
'l','z','a','y','f','a','y','d','l','e','b','b','g','q','y','z','k','x','g','l','d','n','d','n','y','s','k','j','s','h','d','l','y','x','b','c','g','h','x','y',
'p','k','d','j','m','m','z','n','g','m','m','c','l','g','w','z','s','z','x','z','j','f','z','n','m','l','z','z','t','h','c','s','y','d','b','d','l','l','s','c',
'd','d','n','l','k','j','y','k','j','s','y','c','j','l','k','o','h','q','a','s','d','k','n','h','c','s','g','a','a','h','d','a','a','s','h','t','c','p','l','c',
'p','q','y','b','s','d','m','p','j','l','p','c','j','o','q','l','c','d','h','j','j','y','s','p','r','c','h','n','w','j','n','l','h','l','y','y','q','y','h','w',
'z','p','t','d','z','g','w','w','m','z','f','f','j','q','q','q','q','y','x','a','c','l','b','h','k','d','j','x','d','g','m','m','y','d','j','x','z','l','l','s',
'y','g','x','g','k','j','r','y','w','z','w','y','c','l','z','m','s','s','j','z','l','d','b','y','d','c','f','c','x','y','h','l','x','c','h','y','z','j','q','a',
'a','q','a','g','m','n','y','x','p','f','r','k','s','s','b','j','l','y','x','y','s','y','g','l','n','s','c','m','h','c','w','w','m','n','z','j','j','l','x','x',
'h','c','h','s','y','a','a','t','t','x','r','y','c','y','x','b','y','h','c','s','m','x','j','s','z','n','p','w','g','p','x','x','t','a','y','b','g','a','j','c',
'x','l','y','a','d','c','c','w','z','o','c','w','k','c','c','s','b','n','h','c','p','d','y','z','n','f','c','y','y','t','y','c','k','x','k','y','b','s','q','k',
'k','y','t','q','q','x','f','c','w','c','h','c','y','k','e','l','z','q','b','s','q','y','j','q','c','c','l','m','t','h','s','y','w','h','m','k','t','l','k','j',
'l','y','c','x','w','h','e','q','q','h','t','q','h','a','p','q','a','q','s','c','f','y','m','m','d','m','g','b','w','h','w','l','g','s','s','l','y','s','d','l',
'm','l','x','p','t','h','m','j','h','w','l','j','z','y','h','z','j','x','h','t','x','j','l','h','x','r','s','w','l','w','z','j','c','b','x','m','h','z','q','x',
's','d','z','p','s','g','f','c','s','g','l','s','x','y','m','j','s','h','x','p','j','x','w','m','y','q','k','s','m','y','p','l','r','t','h','b','x','f','t','p',
'm','h','y','x','l','c','h','l','h','l','z','y','l','x','g','s','s','s','s','t','c','l','s','l','d','c','l','r','p','b','h','z','h','x','y','y','f','h','b','a',
'g','d','m','y','c','n','q','q','w','l','q','h','j','j','a','y','w','j','z','y','e','j','j','d','h','p','b','l','q','x','t','q','k','w','h','l','c','h','q','x',
'a','g','t','l','x','l','j','x','m','s','l','a','h','t','z','k','z','j','e','c','x','j','c','j','n','m','f','b','y','a','s','f','y','w','y','b','j','z','g','n',
'y','s','d','z','s','q','y','r','s','l','j','p','c','l','p','w','x','s','d','w','e','j','b','j','c','b','c','n','a','y','t','w','g','m','p','a','p','c','l','y',
'q','p','c','l','z','x','s','b','n','m','s','g','g','f','n','z','j','j','b','z','s','f','z','y','n','d','x','h','p','l','q','k','z','c','z','w','a','l','s','b',
'c','c','j','x','a','y','z','g','w','k','y','p','s','g','x','f','z','f','c','d','k','h','j','g','x','d','l','q','f','s','g','d','s','l','q','w','z','k','x','t',
'm','h','s','b','g','z','m','j','z','r','g','l','y','j','b','p','m','l','m','s','x','l','z','j','q','q','h','z','y','j','c','z','y','d','j','w','b','m','j','k',
'l','d','d','p','m','j','e','g','x','y','h','y','l','x','h','l','q','y','q','h','k','y','c','w','c','j','m','y','y','x','n','a','t','j','h','y','c','c','x','z',
'p','c','q','l','b','z','w','w','y','t','w','b','q','c','m','l','p','m','y','r','j','c','c','c','x','f','p','z','n','z','z','l','j','p','l','x','x','y','z','t',
'z','l','g','d','l','d','c','k','l','y','r','l','z','g','q','t','g','j','h','h','g','j','l','j','a','x','f','g','f','j','z','s','l','c','f','d','q','z','l','c',
'l','g','j','d','j','c','s','n','c','l','l','j','p','j','q','d','c','c','l','c','j','x','m','y','z','f','t','s','x','g','c','g','s','b','r','z','x','j','q','q',
'c','t','z','h','g','y','q','t','j','q','q','l','z','x','j','y','l','y','l','b','c','y','a','m','c','s','t','y','l','p','d','j','b','y','r','e','g','k','l','z',
'y','z','h','l','y','s','z','q','l','z','n','w','c','z','c','l','l','w','j','q','j','j','j','k','d','g','j','z','o','l','b','b','z','p','p','g','l','g','h','t',
'g','z','x','y','g','h','z','m','y','c','n','q','s','y','c','y','h','b','h','g','x','k','a','m','t','x','y','x','n','b','s','k','y','z','z','g','j','z','l','q',
'j','d','f','c','j','x','d','y','g','j','q','j','j','p','m','g','w','g','j','j','j','p','k','q','s','b','g','b','m','m','c','j','s','s','c','l','p','q','p','d',
'x','c','d','y','y','k','y','a','c','j','d','d','y','y','g','y','w','r','h','j','r','t','g','z','n','y','q','l','d','k','l','j','s','z','z','g','z','q','z','j',
'g','d','y','k','s','h','p','z','m','t','l','c','p','w','n','j','a','f','y','z','d','j','c','n','m','w','e','s','c','y','g','l','b','t','z','c','g','m','s','s',
'l','l','y','x','q','s','x','s','b','s','j','s','b','b','s','g','g','h','f','j','l','w','p','m','z','j','n','l','y','y','w','d','q','s','h','z','x','t','y','y',
'w','h','m','c','y','h','y','w','d','b','x','b','t','l','m','s','y','y','y','f','s','x','j','c','a','d','x','x','l','h','j','h','f','a','s','x','z','q','h','f',
'z','m','z','c','z','t','q','s','x','z','x','r','t','t','d','j','h','n','n','y','z','q','q','m','n','q','d','m','m','g','a','y','d','x','m','j','g','d','h','c',
'd','y','z','b','f','f','a','l','l','z','t','d','l','t','f','x','m','x','q','z','d','n','g','w','q','d','b','d','c','z','j','d','x','b','z','g','s','q','q','d',
'd','j','c','m','b','k','z','f','f','x','m','k','d','m','d','s','y','y','s','z','c','m','l','j','d','s','y','n','s','p','r','s','k','m','k','m','p','c','k','l',
'g','d','b','q','t','f','z','s','w','t','f','g','g','l','y','p','l','l','j','z','h','g','j','a','g','y','p','z','l','t','c','s','m','c','n','b','t','j','b','q',
'f','k','t','h','b','y','z','g','k','p','b','b','y','m','t','d','s','s','x','t','b','n','p','d','k','l','e','y','c','j','n','y','d','d','y','k','z','d','d','h',
'q','h','s','d','z','s','c','t','a','r','l','l','t','k','z','l','g','e','c','l','l','k','j','l','q','j','a','q','n','b','d','k','k','g','h','p','j','t','z','q',
'k','s','e','c','s','h','a','l','q','f','m','m','g','j','n','l','y','j','b','b','t','m','l','y','z','x','d','t','j','p','l','d','l','p','c','q','d','h','z','y',
'c','b','z','s','c','z','b','z','m','s','l','j','f','l','k','r','z','j','s','n','f','r','g','j','h','x','p','d','h','y','j','y','b','z','g','d','l','q','c','s',
'e','z','g','x','l','b','l','g','y','x','t','w','m','a','b','c','h','e','c','m','w','y','j','y','z','l','l','j','j','y','h','l','g','a','d','j','l','s','l','y',
'g','k','d','z','p','z','x','j','y','y','z','l','w','c','x','s','z','f','g','w','y','y','d','l','y','h','c','l','j','s','c','m','b','j','h','b','l','y','z','l',
'y','c','b','l','y','d','p','d','q','y','s','x','q','z','b','y','t','d','k','y','x','j','y','a','c','n','r','j','m','p','d','j','g','k','l','c','l','j','b','c',
't','b','j','d','d','b','b','l','b','l','c','z','q','r','p','s','x','j','c','g','l','z','c','s','h','l','t','o','l','j','n','m','d','d','d','l','n','g','k','a',
'q','h','q','h','j','g','y','k','h','e','z','n','m','s','h','r','p','h','q','q','j','c','h','g','m','f','p','r','x','h','j','g','d','y','c','h','g','h','l','y',
'r','z','q','l','c','y','q','j','n','z','s','q','t','k','q','j','y','m','s','z','s','w','l','c','f','q','q','q','x','y','f','g','g','y','p','t','q','w','l','m',
'c','r','n','f','k','k','f','s','y','y','l','q','b','m','q','a','m','m','m','y','x','c','t','p','s','h','c','p','t','x','x','z','z','s','m','p','h','p','s','h',
'm','c','l','m','l','d','q','f','y','q','x','s','z','y','j','d','j','j','z','z','h','q','p','d','s','z','g','l','s','t','j','b','c','k','b','x','y','q','z','j',
's','g','p','s','x','q','z','q','z','r','q','t','b','d','k','y','x','z','k','h','h','g','f','l','b','c','s','m','d','l','d','g','d','z','d','b','l','z','y','y',
'c','x','n','n','c','s','y','b','z','b','f','g','l','z','z','x','s','w','m','s','c','c','m','q','n','j','q','s','b','d','q','s','j','t','x','x','m','b','l','t',
'x','z','c','l','z','s','h','z','c','x','r','q','j','g','j','y','l','x','z','f','j','p','h','y','m','z','q','q','z','d','f','q','j','j','l','z','z','n','z','j',
'c','d','g','z','y','g','c','t','x','m','z','y','s','c','t','l','k','p','h','t','x','h','t','l','b','j','x','j','l','x','s','c','d','q','x','c','b','b','t','j',
'f','q','z','f','s','l','t','j','b','t','k','q','b','x','x','j','j','l','j','c','h','c','z','d','b','z','j','d','c','z','j','d','c','p','r','n','p','q','c','j',
'p','f','c','z','l','c','l','z','x','z','d','m','x','m','p','h','j','s','g','z','g','s','z','z','q','j','y','l','w','t','j','p','f','s','y','a','s','m','c','j',
'b','t','z','k','y','c','w','m','y','t','c','s','j','j','l','q','c','q','l','w','z','m','a','l','b','x','y','f','b','p','n','l','s','f','h','t','g','j','w','e',
'j','j','x','x','g','l','l','j','s','t','g','s','h','j','q','l','z','f','k','c','g','n','n','d','s','z','f','d','e','q','f','h','b','s','a','q','t','g','y','l',
'b','x','m','m','y','g','s','z','l','d','y','d','q','m','j','j','r','g','b','j','t','k','g','d','h','g','k','b','l','q','k','b','d','m','b','y','l','x','w','c',
'x','y','t','t','y','b','k','m','r','t','j','z','x','q','j','b','h','l','m','h','m','j','j','z','m','q','a','s','l','d','c','y','x','y','q','d','l','q','c','a',
'f','y','w','y','x','q','h','z'};
int lIndexCode = 0;
int lOffset = 0;
int lLen = 0;
int lLength = 0;
int i = 0;
TCHAR tLocal[5] = {0};
TCHAR *pTSTR = NULL;
TCHAR alpha = 0;
int nLen = (int)_tcslen( tName );
TCHAR *szDest = new TCHAR[nLen + 1];
LCMapString( MAKELCID(MAKELANGID(LANG_CHINESE,SUBLANG_CHINESE_SIMPLIFIED),SORT_CHINESE_PRC),LCMAP_SIMPLIFIED_CHINESE, tName, nLen, szDest, nLen+1);
szDest[nLen] = 0;
lOffset = 0;
lLength = 0;
pTSTR = szDest;
char *ucBuf = NULL;
int len = WideCharToMultiByte(936, 0, szDest, -1, NULL, 0, NULL, NULL);
ucBuf = new char[len + 1];
memset(ucBuf, 0, sizeof(char) * (len + 1));
::WideCharToMultiByte(936, 0, szDest, -1, ucBuf, len, NULL, NULL);
lLen = (int)strlen(ucBuf);
while ((lOffset < lLen) && (lLength < maxlen))
{
if ((unsigned char)ucBuf[lOffset] >= 0XB0)
{
lIndexCode = (unsigned char)ucBuf[lOffset] - 0XB0;
lIndexCode *= 94;
lIndexCode += (unsigned char)ucBuf[lOffset + 1] - 0xA1;
lIndexCode = MAX(0,MIN(6767,lIndexCode));
alpha = hzcode[lIndexCode];
if(alpha<'a' || alpha>'z')
alpha = 'a';
lOffset += 2;
}
else if((unsigned char)ucBuf[ lOffset ] >= 0x80)
{
alpha = '0';
lOffset += 1;
}
else
{
alpha = ucBuf[lOffset];
if(alpha >= 'A' && alpha <='Z')
alpha = (alpha - 'A') + 'a';
lOffset += 1;
}
tLocal[lLength] = alpha;
lLength ++;
}
tLocal[lLength] = 0;
i = 0;
int iLen = (int)_tcslen(tLocal);
while((i < iLen) && (i < maxlen))
{
if((tLocal[i] >= 'A') && (tLocal[i] <= 'Z'))
tLocal[i] = (tLocal[i] - 'A') + 'a';
i++;
}
_tcscpy_s( tLocalizerLetter, maxlen+1, tLocal );
if (NULL != ucBuf)
{
delete [] ucBuf;
ucBuf = NULL;
}
if (NULL !=szDest)
{
delete [] szDest;
szDest = NULL;
}
}
|