function cutstr(str ,len){

   var temp,

       icount = 0,

       patrn =/[^\x00-\xff]/,

       strre = "";

    for(var i = 0; i< str.length; i++){

        if(icount < len -1){

            temp = str.substr(i,1);

                 if(patrn.exec(temp) == null) {

        icount = icount + 1;

        }else{

         icount= icount +2;       

   }

   strre += temp;

      }else{

       break;

   }

 }

  return strre + "...";

}

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-24
  • 2022-01-10
  • 2022-12-23
  • 2021-10-03
相关资源
相似解决方案