mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-21 02:29:23 +00:00
refactored
This commit is contained in:
parent
75dafc40ff
commit
ebbc8d2ad4
4 changed files with 37 additions and 22 deletions
26
lib/util.js
26
lib/util.js
|
|
@ -176,7 +176,31 @@ Util = exports || {};
|
|||
* @param pSubStr
|
||||
*/
|
||||
Util.removeStr = function(pStr, pSubStr){
|
||||
return pStr.replace(pSubStr, '');
|
||||
var lRet;
|
||||
if( Util.isString(pStr) ){
|
||||
var n = pSubStr.length;
|
||||
|
||||
if( Util.isArray(pSubStr) )
|
||||
Util.fori(n, function(i){
|
||||
lRet = pStr = pStr.replace(pSubStr[i], '');
|
||||
});
|
||||
else
|
||||
lRet = pStr.replace(pSubStr, '');
|
||||
}
|
||||
|
||||
return lRet;
|
||||
};
|
||||
|
||||
Util.for = function(pI, pN, pFunc){
|
||||
if(Util.isFunction(pFunc))
|
||||
for(var i = pI, n = pN; i < n; i++)
|
||||
pFunc(i);
|
||||
};
|
||||
|
||||
Util.fori = function(pN, pFunc){
|
||||
var lRet = Util.for(0, pN, pFunc);
|
||||
|
||||
return lRet;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue