Date: 03/17/06 (Java Web) Keywords: java Javascript doesn't natively support trim on strings. It is however very easy to implement with regular expressions. <script language="javascript"> function trim (str) { str = this != window? this : str; return str.replace(/^\s+/, '').replace(/\s+$/, ''); } [...] Source: http://blog.taragana.com/index.php/archive/how-to-trim-in-javascript/
|