Asp.net string truncation Function
Public string CutStr (string str, int len)
{String s = "";
For (int I = 0; I 11 {
Int r = I % len;
Int last = (str. Length/len) * len;
If (I! = 0 & I <= last)
{
If (r = 0)
{
S + = str. Substring (I-len, len) +"
;
}
}
Else if (I> last)
{
S + = str. Substring (I-1 );
Break;
}
}
Return s;
}
/**////
/// Intercept the string and limit the length of the string, more than the given length +...
///
/// String to be truncated
/// The length of each line, more than the length of this line automatically wrap
/// Maximum length of the output string
///
Public string CutStr (string str, int len, int max)
{
String s = "";
String sheng = "";
If (str. Length> max)
{
Str = str. Substring (0, max );
Sheng = "";
}
For (int I = 0; I 53 {
Int r = I % len;
Int last = (str. Length/len) * len;
If (I! = 0 & I <= last)
{
If (r = 0)
{
S + = str. Substring (I-len, len) +"
";
}
}
Else if (I> last)
{
S + = str. Substring (I-1 );
Break;
}
}
Return s + sheng;
}