|
主题: 就算flash6也没有的string.replace()函数
|
 Demon.S
职务:版主
等级:5
金币:10.0
发贴:2468
|
#12001/11/24 1:29:41
我给他加上好了
////Demon.S flash function lib // str replace String.prototype.replace = replace; function replace (sDelimiter) { var lResult = new Array(); if (sDelimiter == null) { lResult[0] = this; } else { var i = 0; var nIndex = 0; var nStart = 1; var nLength = this.length; var nDelimLength = sDelimiter.length; if (nDelimLength>=1) { while (++i<=nLength) { if ( MBsubstring(this, i, nDelimLength) == sDelimiter) { lResult[nIndex] = MBsubstring(this, nStart, (i-nStart)); nStart = i+nDelimLength; ++nIndex; } } if (nStart<=i) { lResult[nIndex] = MBsubstring (this, nStart, -1); } } else { while (i<=nLength) { lResult[i] = MBsubstring (this, ++i, 1); } } } return lResult; }
|
 |危险|
职务:普通成员
等级:1
金币:11.0
发贴:248
|
#22001/11/24 7:15:47
收藏!
|
 janlay
职务:管理员
等级:7
金币:28.0
发贴:7244
|
#32001/11/25 0:24:44
拽!还支持双字节啊 :cool demons, how many fuctions are in you library? post another?
|
 Demon.S
职务:版主
等级:5
金币:10.0
发贴:2468
|
#42001/11/25 2:53:21
janlay在上个帖子中说 引用: 拽!还支持双字节啊 :cool
demons, how many fuctions are in you library? post another?
sorry,it using for my business  string.replace is usefull,so i share it,but others.... D  S
|
 hacker hacking
职务:普通成员
等级:4
金币:10.0
发贴:1629
|
#52001/11/25 3:44:26
具体怎么用到动画中呀?
|
 |危险|
职务:普通成员
等级:1
金币:11.0
发贴:248
|
|
 Demon.S
职务:版主
等级:5
金币:10.0
发贴:2468
|
#72001/11/26 10:19:37
danger在上个帖子中说 引用: 这里还有一些! www.actionscripts.org/tutorials/advanced/function_library/index.shtml
没搞错?你还拿这个来气我啊,前镇的气没全消呢,因为这个我跟flashguru都不通信了,shit
|
 |危险|
职务:普通成员
等级:1
金币:11.0
发贴:248
|
#82001/11/26 13:14:27
Sorry! ;)
|
 蓝刀
职务:普通成员
等级:1
金币:0.0
发贴:57
|
#92001/12/9 0:43:01
是啊,看不懂的,能否介绍介绍用法,指导指导本菜鸟呢???
|
 Demon.S
职务:版主
等级:5
金币:10.0
发贴:2468
|
#102001/12/11 13:37:26
a="asdfas----asdfasdf----没搞错?"; b=a.replace("----");
编辑历史:[这消息被画魔编辑过(编辑时间2001-12-11 13:38:02)]
|
 Demon.S
职务:版主
等级:5
金币:10.0
发贴:2468
|
#112001/12/11 18:15:03
不用乱想 此地不留人自有留人处
|
 magicwind
职务:普通成员
等级:1
金币:1.0
发贴:160
|
#122001/12/13 11:38:35
画魔在上个帖子中说 引用: a="asdfas----asdfasdf----没搞错?"; b=a.replace("----");
b=a.replace("---"); b=a.replace("--"); b=a.replace("-"); 好象有问题 trace (b); asdfas,-asdfasdf----,asdfasdf,-, asdfas,--asdfasdf----,-asdfasdf----,asdfasdf,--,-, asdfas,,,,asdfasdf,,,, 另外数组生成的","很讨厌!
编辑历史:[这消息被magicwind编辑过(编辑时间2001-12-13 11:39:20)] [这消息被magicwind编辑过(编辑时间2001-12-13 11:44:12)]
|
 Demon.S
职务:版主
等级:5
金币:10.0
发贴:2468
|
#132001/12/13 12:21:18
就是用来剪切到数组的,别无它用,因为很多时候都用到,所以贴过来。
|