function trim(str){   
    str = str.replace(/^(\s|\u00A0)+/,'');   
    for(var i=str.length-1; i>=0; i--){   
        if(/\S/.test(str.charAt(i))){   
            str = str.substring(0, i+1);   
            break;   
        }   
    }   
    return str;   
}  

 

相关文章:

  • 2022-12-23
  • 2021-07-28
  • 2022-02-11
  • 2022-12-23
  • 2021-08-02
猜你喜欢
  • 2022-12-23
  • 2021-07-21
  • 2022-12-23
  • 2022-12-23
  • 2021-06-14
  • 2022-12-23
  • 2022-02-19
相关资源
相似解决方案