@zhongguo168a/yxeditor-common 0.0.21 → 0.0.22
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.
- package/dist/index.d.ts +3 -1
- package/dist/index.esm.js +16 -2
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1879,7 +1879,9 @@ declare class StringUtil {
|
|
|
1879
1879
|
* @param source
|
|
1880
1880
|
*/
|
|
1881
1881
|
evalFormat(format: string, source: any): string;
|
|
1882
|
-
|
|
1882
|
+
splitIndex(val: string, separator: string, index: number, dflt?: string): string;
|
|
1883
|
+
splitFirst(val: string, separator: string, dflt?: string): string;
|
|
1884
|
+
splitLast(val: string, separator: string, dflt?: string): string;
|
|
1883
1885
|
/**
|
|
1884
1886
|
* 从最后一个分隔符截断字符串,返回截断的左右字符串
|
|
1885
1887
|
* @param val
|
package/dist/index.esm.js
CHANGED
|
@@ -5927,12 +5927,26 @@ class StringUtil {
|
|
|
5927
5927
|
}
|
|
5928
5928
|
return result;
|
|
5929
5929
|
}
|
|
5930
|
-
|
|
5930
|
+
splitIndex(val, separator, index, dflt = "") {
|
|
5931
|
+
let arr = val.split(separator);
|
|
5932
|
+
if (arr.length > index) {
|
|
5933
|
+
return arr[index];
|
|
5934
|
+
}
|
|
5935
|
+
return dflt;
|
|
5936
|
+
}
|
|
5937
|
+
splitFirst(val, separator, dflt = "") {
|
|
5938
|
+
let arr = val.split(separator);
|
|
5939
|
+
if (arr.length > 0) {
|
|
5940
|
+
return arr[0];
|
|
5941
|
+
}
|
|
5942
|
+
return dflt;
|
|
5943
|
+
}
|
|
5944
|
+
splitLast(val, separator, dflt = "") {
|
|
5931
5945
|
let arr = val.split(separator);
|
|
5932
5946
|
if (arr.length > 0) {
|
|
5933
5947
|
return arr[arr.length - 1];
|
|
5934
5948
|
}
|
|
5935
|
-
return
|
|
5949
|
+
return dflt;
|
|
5936
5950
|
}
|
|
5937
5951
|
/**
|
|
5938
5952
|
* 从最后一个分隔符截断字符串,返回截断的左右字符串
|