A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: trim($string) in Flash?

  1. #1
    Professional Air Guitarist Frag's Avatar
    Join Date
    Dec 2002
    Location
    Brain, Body, Clothes, Computer Chair, Room, House, Neighborhood, City, State, Country, Continent, World, Galaxy, Universe, and on?
    Posts
    811

    trim($string) in Flash?

    What is the operator equivilent to PHP's trim() in Flash?

  2. #2
    The world goes - hm.. TheCaramella's Avatar
    Join Date
    Dec 2001
    Location
    Second door on the right, next to the ice bear
    Posts
    642
    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!
    ()

  3. #3
    half as fun, double the price senocular's Avatar
    Join Date
    Feb 2002
    Location
    San Francisco, CA (USA)
    Posts
    4,358

  4. #4
    Professional Air Guitarist Frag's Avatar
    Join Date
    Dec 2002
    Location
    Brain, Body, Clothes, Computer Chair, Room, House, Neighborhood, City, State, Country, Continent, World, Galaxy, Universe, and on?
    Posts
    811
    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?
    Last edited by Frag; 06-15-2003 at 04:54 PM.

  5. #5
    Professional Air Guitarist Frag's Avatar
    Join Date
    Dec 2002
    Location
    Brain, Body, Clothes, Computer Chair, Room, House, Neighborhood, City, State, Country, Continent, World, Galaxy, Universe, and on?
    Posts
    811
    Nevermind...problem solved

  6. #6
    Live And Let Live All sutar's Avatar
    Join Date
    Mar 2002
    Posts
    202

    how to use the trim

    How can I use the trim function.

    lets say

    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);
    is this the way it will work ?
    Last edited by sutar; 06-16-2003 at 03:39 AM.

    ______________________________________________


  7. #7
    half as fun, double the price senocular's Avatar
    Join Date
    Feb 2002
    Location
    San Francisco, CA (USA)
    Posts
    4,358
    newVar = myVar.trim();

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center