using System.Runtime.InteropServices;

[DllImport("kernel32", CharSet = CharSet.Auto, SetLastError = true)]
private static extern int LCMapString(int locale, int dwMapFlags, string lpSrcStr, int cchSrc,
									  [Out] string lpDestStr, int cchDest);

public static string ToSimplified(string argSource)
{
	var t = new String(' ', argSource.Length);
	LCMapString(LocaleSystemDefault, LcmapSimplifiedChinese, argSource, argSource.Length, t, argSource.Length);
	return t;
}

public static string ToTraditional(string argSource)
{
	var t = new String(' ', argSource.Length);
	LCMapString(LocaleSystemDefault, LcmapTraditionalChinese, argSource, argSource.Length, t, argSource.Length);
	return t;
}

伊 發表在 痞客邦 留言(0) 人氣()