/// <Summary>
/// Function: Precisely captures strings of the specified length as required
/// Calculate two Chinese characters in English
/// Parameter: STR to be truncated characters, and Len to be intercepted symbol to indicate characters (....)
/// </Summary>
Public static string gottopic (string STR, int Len, string symbol)
{
Int COUNT = 0;
String strtemp = "";
STR = nohtml (STR );
For (INT I = 0; I <Str. length; I ++)
{
If (math. Abs (INT) (Str. substring (I, 1). tochararray () [0])> 255)
{
Count + = 2;
}
Else
{
Count + = 1;
}
If (count <= Len)
{
Strtemp + = Str. substring (I, 1 );
}
Else
{
Return strtemp + symbol;
}
}
Return STR;
}
/// <Summary>
/// Filter out HTML tags
/// </Summary>
/// <Param name = "str"> </param>
/// <Returns> </returns>
Public static string nohtml (string Str)
{
STR = RegEx. Replace (STR, @ "(/<. [^/<] */>)", "", regexoptions. ignorepatternwhitespace | regexoptions. ignorecase );
STR = RegEx. Replace (STR, @ "(/</[^/<] */>)", "", regexoptions. ignorecase | regexoptions. ignorepatternwhitespace );
Return STR;
}