title: calling a trim method in actionscript 2.0
body: <p>Hi I Got a notnull function for a text field as below</p>
  
  <pre><code>private function valStringNotNull( val:String ) :Boolean
      {
          if ( String(val).length &lt;= 0 )
          {
              _errorCode = "StringNull";
              return false;
          }
  
          _errorCode = "NoError";
          return true;
      }
  </code></pre>
  
  <p>and this function is being called here </p>
  
  <pre><code>var pCnt:Number = 0;
    _validateParams[pCnt++] = { type: "notNull",  input: win.firstNameInput , isSendData:true, dataName:"firstName"};
    _validateParams[pCnt++] = { type: "notNull",  input: win.lastNameInput, isSendData:true, dataName:"lastName"};
    _validateParams[pCnt++] = { type: "noValidation", input: roleCombo, isSendData:true, dataName:"role" };
  
    Selection.setFocus(win.firstNameInput);
  </code></pre>
  
  <p>and for the not null I defined this way</p>
  
  <pre><code>private function validateCases ( param:Object ) :Boolean
   {
    _errorObj = param.input || param.input1;
    switch( param.type )
    {
                   case "notNull":
      return valStringNotNull( param.input.text );
     break;
                         }
   }
  </code></pre>
  
  <p>but as you see as I defined the length should be greater than zero its taking even a space as an input and displaying blank white space in my text field so I got a trim function as below </p>
  
  <pre><code>public function ltrim(input:String):String
      {
          var size:Number = input.length;
          for(var i:Number = 0; i &lt; size; i++)
          {
              if(input.charCodeAt(i) &gt; 32)
              {
                  return input.substring(i);
              }
          }
          return "";
      }
  </code></pre>
  
  <p>and I need to call this trim function before my not null function so that it trims off all the leftside white space but as I am very new to flash can some one help me how to keep this trim function before the notnull function.Can some one please help me with this please </p>