mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-24 03:05:41 +00:00
refactor(util) rmStr
This commit is contained in:
parent
24557d3d48
commit
14f312e2ca
1 changed files with 10 additions and 10 deletions
20
lib/util.js
20
lib/util.js
|
|
@ -474,19 +474,19 @@
|
|||
* @param substr
|
||||
*/
|
||||
this.rmStr = function(str, substr) {
|
||||
var n, isArray,
|
||||
isString = Util.isString(str);
|
||||
var strArray = [],
|
||||
isString = Util.isString(str),
|
||||
isArray = Util.isArray(substr);
|
||||
|
||||
if (isString && substr) {
|
||||
n = substr.length;
|
||||
isArray = Util.isArray(substr);
|
||||
|
||||
if (!isArray)
|
||||
str = Util.replaceStr(str, substr, '');
|
||||
if (isArray)
|
||||
strArray = substr;
|
||||
else
|
||||
Util.fori(n, function(i) {
|
||||
str = Util.replaceStr(str, substr[i], '');
|
||||
});
|
||||
strArray.push(substr);
|
||||
|
||||
strArray.forEach(function(strItem) {
|
||||
str = str.replace(strItem, '');
|
||||
});
|
||||
}
|
||||
|
||||
return str;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue