该闪就闪
-=本人学习flash过程中做的一些实验品=-

去掉字串中的空格回车换行以及重复字符

   Flash习作2004-12-20 17:4

//去掉字串中的空格会车换行以及重复字符。
function del(str) {
  str = str.split("");
  str.sort();
  var str2 = "", str3 = "\r\n ", char;
  while (str.length>0) {
    char = str.shift();
    if (char != str2.substr(-1) && str3.indexOf(char) == -1) {
      str2 += char;
    }
  }
  return str2;
}
//--------主程序段----------
new _jh7086(100,1,300,330);
//文本输入框
//this.createTextField("in_out", 0, 50, 50, 300, 300);
with (in_out) {
  type = "input";
  border = true;
  text = "在框内输入需要处理的字串\n然后在框外点击鼠标即可\n字符量大时请耐心等待";
}
//事件响应
this.onMouseUp = function() {
  Selection.setSelection(0, in_out.length);
};
in_out.onKillFocus = function() {
  in_out.text = del(in_out.text);
};
标签集:TAGS:
回复Comments()点击Count()

回复Comments

{commenttime}{commentauthor}

{CommentUrl}
{commentcontent}
我的日历
分类日志
友情链接
最新评论
搜索日志
访问计数
获取 RSS
我的 Blog:
jh7086 最新的 20 条日志
[Flash习作]
[Flash进修]
[Flash推荐]
[Flash涂鸦]
[听~音乐]
[我滴地盘er]
全站 Blog:
全站最新的 20 条日志
Powered by 5DBlog.com