PHP code :--------------------------------------------------------------------------------
<? Php
/**
* ** @ Author: Glad
* ** @ URL: <a href = "http://www.cnpik.com/" target = "_ blank"> http://www.cnpik.com/</a>
* ** @ E_mail: lianxiwoo@sohu.com
* ** @ Use it as needed. Do not collect the money :-)
*/
Function cnSubStr ($ string, $ sublen)
{
If ($ sublen> = strlen ($ string ))
{
Return $ string;
}
$ S = "";
For ($ I = 0; $ I <$ sublen; $ I ++)
{
If (ord ($ string {$ I})> 127)
{
$ S. =$ string {$ I}. $ string {++ $ I };
Continue;
} Else {
$ S. =$ string {$ I };
Continue;
}
}
Return $ s;
} // End Function cnSubStr ($ string, $ sublen)
///// // Use like this:
Echo "<p> ______________________ <p> ";
$ String = "242432 objection: 456 the attack against a wide range of embassy places 7890 ";
$ Sublen = strlen ($ string );
$ Len = 20;
Echo $ string. "<p> ";
Echo "total length:". ($ sublen + 1). "<p> ";
Echo "Number of interceptions:". $ len. "<p> ";
For ($ I = 1; $ I <= $ sublen + 1; $ I ++ ){
If ($ I> $ len ){
Echo $ I. "<B >→</B>". cnSubStr ($ string, $ I )."... <Br> ";
Continue;
}
Echo $ I. "<B >→</B>". cnSubStr ($ string, $ I). "<br> ";
}
?>