<script language="javascript"> 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, ''); } var sf = " This is TEST message "; alert(sf.trim()); </script>
Thursday, June 5, 2008
String Trim() in Javascript
Wednesday, January 2, 2008
Remove blank or null elements from an array
Do you want to remove null or empty elements from an array in PHP? Following is the code that filtered those elements and return new filtered array. Array_filter is the php function that traverse an array and apply the conditions and filter them when codition return false;
Subscribe to:
Posts (Atom)