string S = "Zswang ;
IntPtr P = Marshal . StringToBSTR(S);
int count = 0 ;
while ( Marshal . ReadInt16(P) != 0 )
{
P = new IntPtr ((int)P + 2 );
count ++ ;
}
Text = count . ToString();