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