stringutil.as

来自「flashget43的源代码 一个比较常用的下载程序」· AS 代码 · 共 65 行

AS
65
字号
//contains useful string manipulation functions.String.prototype.TRIM_CHARS = ' \t\r\n';//removes all spaces, \r, \n and tab characters from both sides of the string.String.prototype.trim = function() {	return this.ltrim().rtrim();};//removes all spaces, \r, \n and tab characters from the left side of the string.String.prototype.ltrim = function() {	var idx = 0;	while (idx < this.length) {		if (this.TRIM_CHARS.indexOf(this.charAt(idx)) == -1) {			return this.substring(idx);		}		idx ++;	}	return '';};//removes all spaces, \r, \n and tab characters from the right side of the string.String.prototype.rtrim = function() {	var idx = this.length - 1;	while (idx >= 0) {		if (this.TRIM_CHARS.indexOf(this.charAt(idx)) == -1) {			return this.substring(0, idx + 1);		}		idx --;	}	return '';};String.prototype.strreplace = function(_old, _new, str){	if(_new.indexOf(_old) >= 0) return str;		var str1,str2;	var pos = str.indexOf(_old);	while (pos >= 0 ){		str1 = str.substring(0, pos);		str2 = str.substring(pos+_old.length);		 str = str1 + _new + str2;		 pos = str.indexOf(_old);	};		return str;}//converter_root.converterSpecChars = function(txt_in){   var name = "_CoNvErTeR_TeXt_";   if(this[name] == undefined)    {		this.createTextField(name, 10159, 10, 10, 0, 0);		this[name]._visible = false;		this[name].html = true;   }      this[name].htmlText = txt_in;   return (this[name].text);} 

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?