@zhongguo168a/yxeditor-common 0.0.22 → 0.0.23
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 +10 -0
- package/dist/index.esm.js +17 -0
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1879,6 +1879,16 @@ declare class StringUtil {
|
|
|
1879
1879
|
* @param source
|
|
1880
1880
|
*/
|
|
1881
1881
|
evalFormat(format: string, source: any): string;
|
|
1882
|
+
/**
|
|
1883
|
+
* 使用[separator]分割字符串,并替换掉在[index]位置的字符串
|
|
1884
|
+
* 如果没有发生变化,返回原来的值
|
|
1885
|
+
* @param val
|
|
1886
|
+
* @param separator
|
|
1887
|
+
* @param index
|
|
1888
|
+
* @param replace
|
|
1889
|
+
* @returns
|
|
1890
|
+
*/
|
|
1891
|
+
replaceIndex(val: string, separator: string, index: number, replace?: string): string;
|
|
1882
1892
|
splitIndex(val: string, separator: string, index: number, dflt?: string): string;
|
|
1883
1893
|
splitFirst(val: string, separator: string, dflt?: string): string;
|
|
1884
1894
|
splitLast(val: string, separator: string, dflt?: string): string;
|
package/dist/index.esm.js
CHANGED
|
@@ -5927,6 +5927,23 @@ class StringUtil {
|
|
|
5927
5927
|
}
|
|
5928
5928
|
return result;
|
|
5929
5929
|
}
|
|
5930
|
+
/**
|
|
5931
|
+
* 使用[separator]分割字符串,并替换掉在[index]位置的字符串
|
|
5932
|
+
* 如果没有发生变化,返回原来的值
|
|
5933
|
+
* @param val
|
|
5934
|
+
* @param separator
|
|
5935
|
+
* @param index
|
|
5936
|
+
* @param replace
|
|
5937
|
+
* @returns
|
|
5938
|
+
*/
|
|
5939
|
+
replaceIndex(val, separator, index, replace = "") {
|
|
5940
|
+
let arr = val.split(separator);
|
|
5941
|
+
if (arr.length > index) {
|
|
5942
|
+
arr[index] = replace;
|
|
5943
|
+
return arr.join(separator);
|
|
5944
|
+
}
|
|
5945
|
+
return val;
|
|
5946
|
+
}
|
|
5930
5947
|
splitIndex(val, separator, index, dflt = "") {
|
|
5931
5948
|
let arr = val.split(separator);
|
|
5932
5949
|
if (arr.length > index) {
|