What is the operator equivilent to PHP's trim() in Flash?
Printable View
What is the operator equivilent to PHP's trim() in Flash?
I've searched the Core Java script reference, and found none. It would be nice though...
You could search the java script places, because that's what Action Script is now!
(:))
Thanks for that link...but where is the variable in this?
code:
String.prototype.ltrim = function() {
var i=-1;
while (this.charCodeAt(++i)<33);
return this.substring(i);
};
String.prototype.rtrim = function() {
var i = this.length;
while (this.charCodeAt(--i)<33);
return this.substring(0, ++i);
};
String.prototype.trim = function() {
return this.rtrim().ltrim();
};
Or is that JavaScript?
Nevermind...problem solved:cool:
How can I use the trim function.
lets say
is this the way it will work ?Code:
String.prototype.ltrim = function() {
var i=-1;
while (this.charCodeAt(++i)<33);
return this.substring(i);
};
String.prototype.rtrim = function() {
var i = this.length;
while (this.charCodeAt(--i)<33);
return this.substring(0, ++i);
};
String.prototype.trim = function() {
return this.rtrim().ltrim();
};
var myVar=" abc ";
newVar = trim(myVar);
trace(newVar);
newVar = myVar.trim();