memo(XML, etc)
C#(.NET Framework)
文字数を正確にカウントするには?(サロゲート文字対応)[C#、VB] - @IT
Util
public static int GetCorrectStringLentgh( string str ) { System.Globalization.StringInfo strInfo = new System.Globalization.StringInfo( str ); return strInfo.LengthInTextElements; }
呼ぶ側
string strHello = "hello";
int length = Util.GetCorrectStringLentgh( strHello );