常见问题解答主题-如何修剪空白-修剪/修剪右/修剪左(2008-06-30)
------------------------------------------------------------------------------------ ---------------------------------- 常见问题解答主题 - 我如何修剪空格 - 修剪/trimright/trimleft ------------------------------------------------------------------------------------ ---------------------------------- 使用正则表达式(JavaScript 1.2/jscript 3+): string.prototype.trimleft = 功能() { 返回this.replace(/^\ s+/,''); } string.prototype.trimright = 功能() { 返回this.replace(/\ s+$/,''); } string.prototype.trim = 功能() { 返回this.replace(/^\ s+| \ s+$/g,''); } http://docs.sun.com/source/816-6408-10/regexp.htm http://msdn2.microsoft.com/en-us/library/6wzad2b2.aspx http http http://en.wikipedia.org /wiki/juroman_expression http://www.informatics.sussex.ac.uk/...f/contents.htm http://www.merlyn.demon.demon.co.uk/js-valid.htm - - 这样的帖子每天自动发送一次. 他们的 目标是回答重复的问题,并将内容提供给 持续评估/改进的社区. 完整 comp.lang.javascript常见问题解答位于http://jibbering.com/faq/index.html. 常见问题解答工人是一群志愿者. 这些发送 每日帖子由http://www.pair.com熟练托管.