Thank you, Matthew. I will adapt this.

On 5/13/06, Matthew Simpson <[EMAIL PROTECTED]> wrote:

add in the special chars you want removed...


class Text {
   static function trim(str:String):String {
      //trace("Text.trim called....: " + str);
      if (typeof str != "string") return "";
      var whiteSpace = " \r\n\t\f";
      //Make sure str is a string
      var startPos = 0;
      //Note: if 0 length string startPos will be 0
      var endPos = str.length-1;
      //Note: if 0 length string endPos will be -1
      while (startPos<str.length) {
         if (whiteSpace.indexOf(str.charAt(startPos))<0) {
            break;
         } else {
            startPos++;
         }
      }
      while (endPos>-1) {
         if (whiteSpace.indexOf(str.charAt(endPos))<0) {
            break;
         } else {
            endPos--;
         }
      }
      if (startPos>endPos) {
         return "";
      }
      return str.substring(startPos, endPos+1);
   }

   static function strip(str:String):String {
      //trace("Text.strip called....: " + str);
      var whiteSpace = "\r\n\t\f";
      var tempStr = "";
      for (var i = 0; i < str.length; i++){
         var c = str.charAt(i);
         if (whiteSpace.indexOf(c) == -1) {
            tempStr += c;
         }
      }
      return tempStr;
   }

}


-----Original Message-----
From: [EMAIL PROTECTED] on behalf of Jonathan
Berry
Sent: Sat 5/13/2006 1:08 AM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] Restrict textarea

Users are copying and pasting from a command line program and we are
getting
some special characters that are coming through.

On 5/12/06, Matthew Simpson <[EMAIL PROTECTED]> wrote:
>
> Jonathon,
>
> I'm not sure I understand...A user is inputting the special characters
as
> they type?
>
> Matthew

-------------------------------
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com




_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com




--
Jonathan Berry, M.A.
IT Consultant
619.306.1712(m)
[EMAIL PROTECTED]
www.mindarc.com

-----------------------------------------------------------

This E-mail is covered by the Electronic Communications Privacy Act, 18
U.S.C. ?? 2510-2521 and is legally privileged.
This information is confidential information and is intended only for
the use of the individual or entity named above. If the reader of this
message is not the intended recipient, you are hereby notified that any
dissemination, distribution or copying of this communication is strictly
prohibited.

-----------------------------------------------------------
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to