dzkcc-mflow 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/dist/App.d.ts +22 -22
  2. package/dist/App.js +27 -27
  3. package/dist/_virtual/_tslib.js +30 -30
  4. package/dist/core/Api.d.ts +53 -53
  5. package/dist/core/Core.d.ts +18 -18
  6. package/dist/core/Core.js +78 -78
  7. package/dist/core/Decorators.d.ts +7 -7
  8. package/dist/core/Decorators.js +99 -99
  9. package/dist/core/ICocosResManager.d.ts +11 -11
  10. package/dist/core/ServiceLocator.d.ts +7 -7
  11. package/dist/core/ServiceLocator.js +31 -31
  12. package/dist/core/index.d.ts +5 -5
  13. package/dist/libs/BaseView.d.ts +21 -21
  14. package/dist/libs/BaseView.js +78 -78
  15. package/dist/libs/Broadcaster.d.ts +101 -101
  16. package/dist/libs/Broadcaster.js +240 -240
  17. package/dist/libs/CocosCore.d.ts +5 -5
  18. package/dist/libs/CocosCore.js +16 -16
  19. package/dist/libs/ResLoader.d.ts +10 -10
  20. package/dist/libs/ResLoader.js +76 -74
  21. package/dist/libs/UIManager.d.ts +34 -34
  22. package/dist/libs/UIManager.js +251 -251
  23. package/dist/libs/UIRoot.d.ts +4 -4
  24. package/dist/libs/UIRoot.js +4 -4
  25. package/dist/libs/index.d.ts +6 -6
  26. package/dist/mflow-tools.zip +0 -0
  27. package/dist/utils/ArrayExt.d.ts +67 -67
  28. package/dist/utils/ArrayExt.js +298 -298
  29. package/dist/utils/ArrayUtil.d.ts +41 -41
  30. package/dist/utils/ArrayUtil.js +93 -93
  31. package/dist/utils/CameraUtil.d.ts +10 -10
  32. package/dist/utils/CameraUtil.js +23 -23
  33. package/dist/utils/ImageUtil.d.ts +33 -33
  34. package/dist/utils/ImageUtil.js +92 -92
  35. package/dist/utils/MathUtil.d.ts +213 -213
  36. package/dist/utils/MathUtil.js +435 -435
  37. package/dist/utils/ObjectUtil.d.ts +24 -24
  38. package/dist/utils/ObjectUtil.js +58 -58
  39. package/dist/utils/PlatformUtil.d.ts +9 -9
  40. package/dist/utils/PlatformUtil.js +27 -27
  41. package/dist/utils/RotateUtil.d.ts +30 -30
  42. package/dist/utils/RotateUtil.js +63 -63
  43. package/dist/utils/StringUtil.d.ts +107 -107
  44. package/dist/utils/StringUtil.js +249 -249
  45. package/dist/utils/TimeUtil.d.ts +31 -31
  46. package/dist/utils/TimeUtil.js +85 -85
  47. package/dist/utils/index.d.ts +9 -9
  48. package/package.json +1 -1
@@ -1,24 +1,24 @@
1
- /** 对象工具 */
2
- export declare class ObjectUtil {
3
- /**
4
- * 判断指定的值是否为对象
5
- * @param value 值
6
- */
7
- static isObject(value: any): boolean;
8
- static isObjectLiteral(value: any): boolean;
9
- /**
10
- * 是否是数组
11
- * @param target
12
- */
13
- static isArray(target: any): boolean;
14
- /**
15
- * 深拷贝
16
- * @param target 目标
17
- */
18
- static deepCopy(target: any): any;
19
- /**
20
- * 拷贝对象
21
- * @param target 目标
22
- */
23
- static copy(target: object): object;
24
- }
1
+ /** 对象工具 */
2
+ export declare class ObjectUtil {
3
+ /**
4
+ * 判断指定的值是否为对象
5
+ * @param value 值
6
+ */
7
+ static isObject(value: any): boolean;
8
+ static isObjectLiteral(value: any): boolean;
9
+ /**
10
+ * 是否是数组
11
+ * @param target
12
+ */
13
+ static isArray(target: any): boolean;
14
+ /**
15
+ * 深拷贝
16
+ * @param target 目标
17
+ */
18
+ static deepCopy(target: any): any;
19
+ /**
20
+ * 拷贝对象
21
+ * @param target 目标
22
+ */
23
+ static copy(target: object): object;
24
+ }
@@ -1,61 +1,61 @@
1
- /** 对象工具 */
2
- class ObjectUtil {
3
- /**
4
- * 判断指定的值是否为对象
5
- * @param value 值
6
- */
7
- static isObject(value) {
8
- return Object.prototype.toString.call(value) === '[object Object]';
9
- }
10
- static isObjectLiteral(value) {
11
- return value !== null && typeof value === 'object' && Object.getPrototypeOf(value) === Object.prototype;
12
- }
13
- /**
14
- * 是否是数组
15
- * @param target
16
- */
17
- static isArray(target) {
18
- return Object.prototype.toString.call(target) === "[object Array]";
19
- }
20
- /**
21
- * 深拷贝
22
- * @param target 目标
23
- */
24
- static deepCopy(target) {
25
- if (target == null || typeof target !== 'object') {
26
- return target;
27
- }
28
- let result = null;
29
- if (target instanceof Date) {
30
- result = new Date();
31
- result.setTime(target.getTime());
32
- return result;
33
- }
34
- if (target instanceof Array) {
35
- result = [];
36
- for (let i = 0, length = target.length; i < length; i++) {
37
- result[i] = this.deepCopy(target[i]);
38
- }
39
- return result;
40
- }
41
- if (target instanceof Object) {
42
- result = {};
43
- for (const key in target) {
44
- if (target.hasOwnProperty(key)) {
45
- result[key] = this.deepCopy(target[key]);
46
- }
47
- }
48
- return result;
49
- }
50
- console.warn(`不支持的类型:${result}`);
51
- }
52
- /**
53
- * 拷贝对象
54
- * @param target 目标
55
- */
56
- static copy(target) {
57
- return JSON.parse(JSON.stringify(target));
58
- }
1
+ /** 对象工具 */
2
+ class ObjectUtil {
3
+ /**
4
+ * 判断指定的值是否为对象
5
+ * @param value 值
6
+ */
7
+ static isObject(value) {
8
+ return Object.prototype.toString.call(value) === '[object Object]';
9
+ }
10
+ static isObjectLiteral(value) {
11
+ return value !== null && typeof value === 'object' && Object.getPrototypeOf(value) === Object.prototype;
12
+ }
13
+ /**
14
+ * 是否是数组
15
+ * @param target
16
+ */
17
+ static isArray(target) {
18
+ return Object.prototype.toString.call(target) === "[object Array]";
19
+ }
20
+ /**
21
+ * 深拷贝
22
+ * @param target 目标
23
+ */
24
+ static deepCopy(target) {
25
+ if (target == null || typeof target !== 'object') {
26
+ return target;
27
+ }
28
+ let result = null;
29
+ if (target instanceof Date) {
30
+ result = new Date();
31
+ result.setTime(target.getTime());
32
+ return result;
33
+ }
34
+ if (target instanceof Array) {
35
+ result = [];
36
+ for (let i = 0, length = target.length; i < length; i++) {
37
+ result[i] = this.deepCopy(target[i]);
38
+ }
39
+ return result;
40
+ }
41
+ if (target instanceof Object) {
42
+ result = {};
43
+ for (const key in target) {
44
+ if (target.hasOwnProperty(key)) {
45
+ result[key] = this.deepCopy(target[key]);
46
+ }
47
+ }
48
+ return result;
49
+ }
50
+ console.warn(`不支持的类型:${result}`);
51
+ }
52
+ /**
53
+ * 拷贝对象
54
+ * @param target 目标
55
+ */
56
+ static copy(target) {
57
+ return JSON.parse(JSON.stringify(target));
58
+ }
59
59
  }
60
60
 
61
61
  export { ObjectUtil };
@@ -1,9 +1,9 @@
1
- /** 平台数据 */
2
- export declare class PlatformUtil {
3
- /** 是否为安卓系统 */
4
- static isNativeAndroid(): boolean;
5
- /** 是否为苹果系统 */
6
- static isNativeIOS(): boolean;
7
- /** 获取平台名 */
8
- static getPlateform(): "android" | "ios" | "h5";
9
- }
1
+ /** 平台数据 */
2
+ export declare class PlatformUtil {
3
+ /** 是否为安卓系统 */
4
+ static isNativeAndroid(): boolean;
5
+ /** 是否为苹果系统 */
6
+ static isNativeIOS(): boolean;
7
+ /** 获取平台名 */
8
+ static getPlateform(): "android" | "ios" | "h5";
9
+ }
@@ -1,32 +1,32 @@
1
1
  import { native, sys } from 'cc';
2
2
 
3
- /** 平台数据 */
4
- class PlatformUtil {
5
- /** 是否为安卓系统 */
6
- static isNativeAndroid() {
7
- if (typeof native == "undefined")
8
- return false;
9
- if (sys.isNative && sys.platform === sys.Platform.ANDROID)
10
- return true;
11
- return false;
12
- }
13
- /** 是否为苹果系统 */
14
- static isNativeIOS() {
15
- if (typeof native == "undefined")
16
- return false;
17
- if (sys.isNative && sys.os === sys.OS.IOS)
18
- return true;
19
- return false;
20
- }
21
- /** 获取平台名 */
22
- static getPlateform() {
23
- if (this.isNativeAndroid())
24
- return 'android';
25
- else if (this.isNativeIOS())
26
- return 'ios';
27
- else
28
- return 'h5';
29
- }
3
+ /** 平台数据 */
4
+ class PlatformUtil {
5
+ /** 是否为安卓系统 */
6
+ static isNativeAndroid() {
7
+ if (typeof native == "undefined")
8
+ return false;
9
+ if (sys.isNative && sys.platform === sys.Platform.ANDROID)
10
+ return true;
11
+ return false;
12
+ }
13
+ /** 是否为苹果系统 */
14
+ static isNativeIOS() {
15
+ if (typeof native == "undefined")
16
+ return false;
17
+ if (sys.isNative && sys.os === sys.OS.IOS)
18
+ return true;
19
+ return false;
20
+ }
21
+ /** 获取平台名 */
22
+ static getPlateform() {
23
+ if (this.isNativeAndroid())
24
+ return 'android';
25
+ else if (this.isNativeIOS())
26
+ return 'ios';
27
+ else
28
+ return 'h5';
29
+ }
30
30
  }
31
31
 
32
32
  export { PlatformUtil };
@@ -1,30 +1,30 @@
1
- import { Node, Vec3 } from "cc";
2
- /** 旋转工具 */
3
- export declare class RotateUtil {
4
- /**
5
- * 自由旋转
6
- * @param target 旋转目标
7
- * @param axis 围绕旋转的轴
8
- * @param rad 旋转弧度
9
- */
10
- static rotateAround(target: Node, axis: Vec3, rad: number): void;
11
- /**
12
- * 参考瞄准目标,使当前物体围绕瞄准目标旋转
13
- * 1、先通过弧度计算旋转四元数
14
- * 2、通过旋转中心点或当前目标点向量相减计算出移动方向
15
- * 3、计算起始向量旋转后的向量
16
- * 4、计算旋转后的坐标点
17
- * @param lookAt 瞄准目标
18
- * @param target 旋转目标
19
- * @param axis 围绕旋转的轴(例:Vec3.UP为Y轴)
20
- * @param rad 旋转弧度(例:delta.x * 1e-2)
21
- */
22
- static rotateAroundTarget(lookAt: Node, target: Node, axis: Vec3, rad: number): void;
23
- /**
24
- * 获取心半径边上的位置
25
- * @param center 圆心
26
- * @param radius 半径
27
- * @param angle 角度
28
- */
29
- static circularEdgePosition(center: Vec3, radius: number, angle: number): Vec3;
30
- }
1
+ import { Node, Vec3 } from "cc";
2
+ /** 旋转工具 */
3
+ export declare class RotateUtil {
4
+ /**
5
+ * 自由旋转
6
+ * @param target 旋转目标
7
+ * @param axis 围绕旋转的轴
8
+ * @param rad 旋转弧度
9
+ */
10
+ static rotateAround(target: Node, axis: Vec3, rad: number): void;
11
+ /**
12
+ * 参考瞄准目标,使当前物体围绕瞄准目标旋转
13
+ * 1、先通过弧度计算旋转四元数
14
+ * 2、通过旋转中心点或当前目标点向量相减计算出移动方向
15
+ * 3、计算起始向量旋转后的向量
16
+ * 4、计算旋转后的坐标点
17
+ * @param lookAt 瞄准目标
18
+ * @param target 旋转目标
19
+ * @param axis 围绕旋转的轴(例:Vec3.UP为Y轴)
20
+ * @param rad 旋转弧度(例:delta.x * 1e-2)
21
+ */
22
+ static rotateAroundTarget(lookAt: Node, target: Node, axis: Vec3, rad: number): void;
23
+ /**
24
+ * 获取心半径边上的位置
25
+ * @param center 圆心
26
+ * @param radius 半径
27
+ * @param angle 角度
28
+ */
29
+ static circularEdgePosition(center: Vec3, radius: number, angle: number): Vec3;
30
+ }
@@ -1,69 +1,69 @@
1
1
  import { Quat, Vec3, toRadian } from 'cc';
2
2
  import { MathUtil } from './MathUtil.js';
3
3
 
4
- /** 旋转工具 */
5
- class RotateUtil {
6
- /**
7
- * 自由旋转
8
- * @param target 旋转目标
9
- * @param axis 围绕旋转的轴
10
- * @param rad 旋转弧度
11
- */
12
- static rotateAround(target, axis, rad) {
13
- var quat = new Quat();
14
- Quat.rotateAround(quat, target.getRotation(), axis.normalize(), rad);
15
- target.setRotation(quat);
16
- }
17
- /**
18
- * 参考瞄准目标,使当前物体围绕瞄准目标旋转
19
- * 1、先通过弧度计算旋转四元数
20
- * 2、通过旋转中心点或当前目标点向量相减计算出移动方向
21
- * 3、计算起始向量旋转后的向量
22
- * 4、计算旋转后的坐标点
23
- * @param lookAt 瞄准目标
24
- * @param target 旋转目标
25
- * @param axis 围绕旋转的轴(例:Vec3.UP为Y轴)
26
- * @param rad 旋转弧度(例:delta.x * 1e-2)
27
- */
28
- static rotateAroundTarget(lookAt, target, axis, rad) {
29
- // 计算坐标
30
- var point_lookAt = lookAt.worldPosition; // 锚点坐标
31
- var point_target = target.worldPosition; // 目标坐标
32
- var quat = new Quat();
33
- var vec3 = new Vec3();
34
- // 算出坐标点的旋转四元数
35
- Quat.fromAxisAngle(quat, axis, rad);
36
- // 计算旋转点和现有点的向量
37
- Vec3.subtract(vec3, point_target, point_lookAt);
38
- // 计算将向量做旋转操作后的向量
39
- Vec3.transformQuat(vec3, vec3, quat);
40
- // 计算目标旋转后的点
41
- Vec3.add(vec3, point_lookAt, vec3);
42
- target.setWorldPosition(vec3);
43
- // 计算目标朝向瞄准点
44
- Quat.rotateAround(quat, target.worldRotation, axis, rad);
45
- Quat.normalize(quat, quat);
46
- target.setWorldRotation(quat);
47
- }
48
- /**
49
- * 获取心半径边上的位置
50
- * @param center 圆心
51
- * @param radius 半径
52
- * @param angle 角度
53
- */
54
- static circularEdgePosition(center, radius, angle) {
55
- let edge = Vec3.UNIT_Z.multiplyScalar(radius); // 距离圆心Z抽的距离
56
- let dir = MathUtil.subV3(edge, center); // 初始圆心与目标位置的方向
57
- let vec3 = new Vec3();
58
- var quat = new Quat();
59
- // 算出坐标点的旋转四元数
60
- Quat.fromAxisAngle(quat, Vec3.UP, toRadian(angle));
61
- // 计算将向量做旋转操作后的向量
62
- Vec3.transformQuat(vec3, dir, quat);
63
- // 计算目标旋转后的点
64
- Vec3.add(vec3, center, vec3);
65
- return vec3;
66
- }
4
+ /** 旋转工具 */
5
+ class RotateUtil {
6
+ /**
7
+ * 自由旋转
8
+ * @param target 旋转目标
9
+ * @param axis 围绕旋转的轴
10
+ * @param rad 旋转弧度
11
+ */
12
+ static rotateAround(target, axis, rad) {
13
+ var quat = new Quat();
14
+ Quat.rotateAround(quat, target.getRotation(), axis.normalize(), rad);
15
+ target.setRotation(quat);
16
+ }
17
+ /**
18
+ * 参考瞄准目标,使当前物体围绕瞄准目标旋转
19
+ * 1、先通过弧度计算旋转四元数
20
+ * 2、通过旋转中心点或当前目标点向量相减计算出移动方向
21
+ * 3、计算起始向量旋转后的向量
22
+ * 4、计算旋转后的坐标点
23
+ * @param lookAt 瞄准目标
24
+ * @param target 旋转目标
25
+ * @param axis 围绕旋转的轴(例:Vec3.UP为Y轴)
26
+ * @param rad 旋转弧度(例:delta.x * 1e-2)
27
+ */
28
+ static rotateAroundTarget(lookAt, target, axis, rad) {
29
+ // 计算坐标
30
+ var point_lookAt = lookAt.worldPosition; // 锚点坐标
31
+ var point_target = target.worldPosition; // 目标坐标
32
+ var quat = new Quat();
33
+ var vec3 = new Vec3();
34
+ // 算出坐标点的旋转四元数
35
+ Quat.fromAxisAngle(quat, axis, rad);
36
+ // 计算旋转点和现有点的向量
37
+ Vec3.subtract(vec3, point_target, point_lookAt);
38
+ // 计算将向量做旋转操作后的向量
39
+ Vec3.transformQuat(vec3, vec3, quat);
40
+ // 计算目标旋转后的点
41
+ Vec3.add(vec3, point_lookAt, vec3);
42
+ target.setWorldPosition(vec3);
43
+ // 计算目标朝向瞄准点
44
+ Quat.rotateAround(quat, target.worldRotation, axis, rad);
45
+ Quat.normalize(quat, quat);
46
+ target.setWorldRotation(quat);
47
+ }
48
+ /**
49
+ * 获取心半径边上的位置
50
+ * @param center 圆心
51
+ * @param radius 半径
52
+ * @param angle 角度
53
+ */
54
+ static circularEdgePosition(center, radius, angle) {
55
+ let edge = Vec3.UNIT_Z.multiplyScalar(radius); // 距离圆心Z抽的距离
56
+ let dir = MathUtil.subV3(edge, center); // 初始圆心与目标位置的方向
57
+ let vec3 = new Vec3();
58
+ var quat = new Quat();
59
+ // 算出坐标点的旋转四元数
60
+ Quat.fromAxisAngle(quat, Vec3.UP, toRadian(angle));
61
+ // 计算将向量做旋转操作后的向量
62
+ Vec3.transformQuat(vec3, dir, quat);
63
+ // 计算目标旋转后的点
64
+ Vec3.add(vec3, center, vec3);
65
+ return vec3;
66
+ }
67
67
  }
68
68
 
69
69
  export { RotateUtil };
@@ -1,107 +1,107 @@
1
- /** 字符串工具 */
2
- export declare class StringUtil {
3
- /** 获取一个唯一标识的字符串 */
4
- static guid(): string;
5
- /**
6
- * 转美式计数字符串
7
- * @param value 数字
8
- * @example
9
- * 123456789 = 123,456,789
10
- */
11
- static numberTotPermil(value: number): string;
12
- /**
13
- * 转英文单位计数
14
- * @param value 数字
15
- * @param fixed 保留小数位数
16
- * @example
17
- * 12345 = 12.35K
18
- */
19
- static numberToThousand(value: number, fixed?: number): string;
20
- /**
21
- * 转中文单位计数
22
- * @param value 数字
23
- * @param fixed 保留小数位数
24
- * @example
25
- * 12345 = 1.23万
26
- */
27
- static numberToTenThousand(value: number, fixed?: number): string;
28
- /**
29
- * "," 分割字符串成数组
30
- * @param str 字符串
31
- */
32
- static stringToArray1(str: string): string[];
33
- /**
34
- * "|" 分割字符串成数组
35
- * @param str 字符串
36
- */
37
- static stringToArray2(str: string): string[];
38
- /**
39
- * ":" 分割字符串成数组
40
- * @param str 字符串
41
- */
42
- static stringToArray3(str: string): string[];
43
- /**
44
- * ";" 分割字符串成数组
45
- * @param str 字符串
46
- */
47
- static stringToArray4(str: string): string[];
48
- /**
49
- * 字符串截取
50
- * @param str 字符串
51
- * @param n 截取长度
52
- * @param showdot 是否把截取的部分用省略号代替
53
- */
54
- static sub(str: string, n: number, showdot?: boolean): string;
55
- /**
56
- * 计算字符串长度,中文算两个字节
57
- * @param str 字符串
58
- */
59
- static stringLen(str: string): number;
60
- /**
61
- * 截取字符串,显示省略号
62
- * @param str
63
- * @param len
64
- */
65
- static ellipsisString(str: string, maxChars: number): string;
66
- /**
67
- * 是否为空或者空格
68
- * @param str
69
- */
70
- static isEmptyOrWhiteSpace(str: string): boolean;
71
- /**
72
- * 参数替换
73
- * @param str
74
- * @param rest
75
- *
76
- * @example
77
- *
78
- * var str:string = "here is some info '{0}' and {1}";
79
- * StringUtil.substitute(str, 15.4, true);
80
- * "here is some info '15.4' and true"
81
- *
82
- * const result = substitute("Hello, {name}! Today is {day}.", "John Doe", "Monday");
83
- * console.log(result); // 输出: Hello, John Doe! Today is Monday.
84
- *
85
- * const result2 = substitute("The value of {abc} is {num} and the variable {xyz} has the value {value}.", {abc: 123, num: "456", xyz: "789", value: "hello"});
86
- * console.log(result2); // 输出: The value of 123 is 456 and the variable 789 has the value hello.
87
- */
88
- static substitute(str: string, ...rest: any[]): string;
89
- /**
90
- * 获取字符串中指定字符的全部索引
91
- * @param mainStr
92
- * @param subStr
93
- * @returns
94
- */
95
- static findAllSubstringsIndexes(mainStr: string, subStr: string): number[];
96
- /**
97
- * 用于将英文文本包围在 Unicode RLE 和 PDF 字符中,以确保其在 RTL 文本中正确显示
98
- * @param text
99
- * @returns
100
- */
101
- static surroundLTRWithUnicode(text: string): string;
102
- /**
103
- * 判断字符是否为双字节字符(如中文字符)
104
- * @param string 原字符串
105
- */
106
- static isDoubleWord(string: string): boolean;
107
- }
1
+ /** 字符串工具 */
2
+ export declare class StringUtil {
3
+ /** 获取一个唯一标识的字符串 */
4
+ static guid(): string;
5
+ /**
6
+ * 转美式计数字符串
7
+ * @param value 数字
8
+ * @example
9
+ * 123456789 = 123,456,789
10
+ */
11
+ static numberTotPermil(value: number): string;
12
+ /**
13
+ * 转英文单位计数
14
+ * @param value 数字
15
+ * @param fixed 保留小数位数
16
+ * @example
17
+ * 12345 = 12.35K
18
+ */
19
+ static numberToThousand(value: number, fixed?: number): string;
20
+ /**
21
+ * 转中文单位计数
22
+ * @param value 数字
23
+ * @param fixed 保留小数位数
24
+ * @example
25
+ * 12345 = 1.23万
26
+ */
27
+ static numberToTenThousand(value: number, fixed?: number): string;
28
+ /**
29
+ * "," 分割字符串成数组
30
+ * @param str 字符串
31
+ */
32
+ static stringToArray1(str: string): string[];
33
+ /**
34
+ * "|" 分割字符串成数组
35
+ * @param str 字符串
36
+ */
37
+ static stringToArray2(str: string): string[];
38
+ /**
39
+ * ":" 分割字符串成数组
40
+ * @param str 字符串
41
+ */
42
+ static stringToArray3(str: string): string[];
43
+ /**
44
+ * ";" 分割字符串成数组
45
+ * @param str 字符串
46
+ */
47
+ static stringToArray4(str: string): string[];
48
+ /**
49
+ * 字符串截取
50
+ * @param str 字符串
51
+ * @param n 截取长度
52
+ * @param showdot 是否把截取的部分用省略号代替
53
+ */
54
+ static sub(str: string, n: number, showdot?: boolean): string;
55
+ /**
56
+ * 计算字符串长度,中文算两个字节
57
+ * @param str 字符串
58
+ */
59
+ static stringLen(str: string): number;
60
+ /**
61
+ * 截取字符串,显示省略号
62
+ * @param str
63
+ * @param len
64
+ */
65
+ static ellipsisString(str: string, maxChars: number): string;
66
+ /**
67
+ * 是否为空或者空格
68
+ * @param str
69
+ */
70
+ static isEmptyOrWhiteSpace(str: string): boolean;
71
+ /**
72
+ * 参数替换
73
+ * @param str
74
+ * @param rest
75
+ *
76
+ * @example
77
+ *
78
+ * var str:string = "here is some info '{0}' and {1}";
79
+ * StringUtil.substitute(str, 15.4, true);
80
+ * "here is some info '15.4' and true"
81
+ *
82
+ * const result = substitute("Hello, {name}! Today is {day}.", "John Doe", "Monday");
83
+ * console.log(result); // 输出: Hello, John Doe! Today is Monday.
84
+ *
85
+ * const result2 = substitute("The value of {abc} is {num} and the variable {xyz} has the value {value}.", {abc: 123, num: "456", xyz: "789", value: "hello"});
86
+ * console.log(result2); // 输出: The value of 123 is 456 and the variable 789 has the value hello.
87
+ */
88
+ static substitute(str: string, ...rest: any[]): string;
89
+ /**
90
+ * 获取字符串中指定字符的全部索引
91
+ * @param mainStr
92
+ * @param subStr
93
+ * @returns
94
+ */
95
+ static findAllSubstringsIndexes(mainStr: string, subStr: string): number[];
96
+ /**
97
+ * 用于将英文文本包围在 Unicode RLE 和 PDF 字符中,以确保其在 RTL 文本中正确显示
98
+ * @param text
99
+ * @returns
100
+ */
101
+ static surroundLTRWithUnicode(text: string): string;
102
+ /**
103
+ * 判断字符是否为双字节字符(如中文字符)
104
+ * @param string 原字符串
105
+ */
106
+ static isDoubleWord(string: string): boolean;
107
+ }