---
title: "JS 去掉字符串空格"
author: "beautyOfProgram"
date: "2010-10-09T18:46:17Z"
tags: []
categories: ["Web前端"]
slug: "js"
draft: false
lastmod: "2010-10-09T18:46:17Z"
id: 780097
url: "https://beautyofprogram.iteye.com/blog/780097"
---

java 去掉字符串空格

 

```
<!--
// Trim() , Ltrim() , RTrim()
String.prototype.Trim = function() 
{ 
return this.replace(/(^\s*)|(\s*$)/g, ""); 
} 
String.prototype.LTrim = function() 
{ 
return this.replace(/(^\s*)/g, ""); 
} 
String.prototype.RTrim = function() 
{ 
return this.replace(/(\s*$)/g, ""); 
} 
//-->
```