Friday, November 3
javascript Trim method
Javascript has no trim() method that is required all the time.
This script will strip starting and ending spaces for you..
This script will strip starting and ending spaces for you..
72 // JScript File
73 //javascript left & right trim similar to stringObj.Trim() in C#
74 function trimAll(sString)
75 {
76 while (sString.substring(0,1) == ' ')
77 {
78 sString = sString.substring(1, sString.length);
79 }
80 while (sString.substring(sString.length-1, sString.length) == ' ')
81 {
82 sString = sString.substring(0,sString.length-1);
83 }
84 return sString;
85 }
Subscribe to Posts [Atom]