新增StringUtils.isNullOrEmpty方法

This commit is contained in:
yhh
2021-08-26 13:58:09 +08:00
parent 5d1609111c
commit a4b971bba0
4 changed files with 555 additions and 519 deletions

View File

@@ -2093,7 +2093,8 @@ declare module es {
updateLists(): void;
}
}
declare class StringUtils {
declare module es {
class StringUtils {
/**
* 特殊符号字符串
*/
@@ -2128,6 +2129,12 @@ declare class StringUtils {
* @return 返回该字符是否为空白字符
*/
static isWhiteSpace(str: string): boolean;
/**
* 返回该字符是否为空字符或者为null
* @param str
* @returns
*/
static isNullOrEmpty(str: string): boolean;
/**
* 返回执行替换后的字符串
* @param mainStr 待查找字符串
@@ -2174,6 +2181,7 @@ declare class StringUtils {
*/
static strReplace(str: string, rStr: string[]): string;
static format(str: string, ...args: any[]): string;
}
}
declare module es {
/** 提供帧定时信息 */

View File

@@ -301,19 +301,19 @@ var es;
}
switch (type) {
case LogType.error:
console.error(type + ": " + StringUtils.format(format, args));
console.error(type + ": " + es.StringUtils.format(format, args));
break;
case LogType.warn:
console.warn(type + ": " + StringUtils.format(format, args));
console.warn(type + ": " + es.StringUtils.format(format, args));
break;
case LogType.log:
console.log(type + ": " + StringUtils.format(format, args));
console.log(type + ": " + es.StringUtils.format(format, args));
break;
case LogType.info:
console.info(type + ": " + StringUtils.format(format, args));
console.info(type + ": " + es.StringUtils.format(format, args));
break;
case LogType.trace:
console.trace(type + ": " + StringUtils.format(format, args));
console.trace(type + ": " + es.StringUtils.format(format, args));
break;
default:
throw new Error('argument out of range');
@@ -360,7 +360,7 @@ var es;
console.assert(false);
}
else {
console.assert(false, StringUtils.format(message, args));
console.assert(false, es.StringUtils.format(message, args));
}
};
Insist.isTrue = function (condition, message) {
@@ -5468,7 +5468,9 @@ var es;
}());
es.RenderableComponentList = RenderableComponentList;
})(es || (es = {}));
var StringUtils = /** @class */ (function () {
var es;
(function (es) {
var StringUtils = /** @class */ (function () {
function StringUtils() {
}
/**
@@ -5526,6 +5528,16 @@ var StringUtils = /** @class */ (function () {
return true;
return false;
};
/**
* 返回该字符是否为空字符或者为null
* @param str
* @returns
*/
StringUtils.isNullOrEmpty = function (str) {
if (str == "" || str == null || str == undefined)
return true;
return false;
};
/**
* 返回执行替换后的字符串
* @param mainStr 待查找字符串
@@ -5690,7 +5702,9 @@ var StringUtils = /** @class */ (function () {
'™', '™',
];
return StringUtils;
}());
}());
es.StringUtils = StringUtils;
})(es || (es = {}));
var es;
(function (es) {
/** 提供帧定时信息 */

File diff suppressed because one or more lines are too long

View File

@@ -1,4 +1,5 @@
class StringUtils {
module es {
export class StringUtils {
/**
* 特殊符号字符串
*/
@@ -73,6 +74,18 @@ class StringUtils {
return false;
}
/**
* 返回该字符是否为空字符或者为null
* @param str
* @returns
*/
public static isNullOrEmpty(str: string): boolean {
if (str == "" || str == null || str == undefined)
return true;
return false;
}
/**
* 返回执行替换后的字符串
* @param mainStr 待查找字符串
@@ -228,4 +241,5 @@ class StringUtils {
return str;
}
}
}