mirror of
https://gitee.com/onvia/ccc-tnt-psd2ui
synced 2024-12-25 19:28:25 +00:00
增加移除规则标记末尾的中文
This commit is contained in:
parent
12975ba1a8
commit
963a48256a
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ccc-tnt-psd2ui",
|
"name": "ccc-tnt-psd2ui",
|
||||||
"version": "1.0.2",
|
"version": "1.0.3",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
7
psd2ui-tools/dist/index.js
vendored
7
psd2ui-tools/dist/index.js
vendored
@ -1256,11 +1256,14 @@
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
removeChineseFromEnd(inputString) {
|
removeChineseFromEnd(inputString) {
|
||||||
|
if (!inputString) {
|
||||||
|
return inputString;
|
||||||
|
}
|
||||||
const chineseRegex = /[\u4e00-\u9fa5]+$/;
|
const chineseRegex = /[\u4e00-\u9fa5]+$/;
|
||||||
const match = inputString.match(chineseRegex);
|
const match = inputString.trim().match(chineseRegex);
|
||||||
if (match && match[0]) {
|
if (match && match[0]) {
|
||||||
const chineseLength = match[0].length;
|
const chineseLength = match[0].length;
|
||||||
return inputString.slice(0, -chineseLength);
|
return this.removeChineseFromEnd(inputString.slice(0, -chineseLength));
|
||||||
}
|
}
|
||||||
return inputString;
|
return inputString;
|
||||||
}
|
}
|
||||||
|
@ -206,14 +206,17 @@ export abstract class PsdLayer {
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
removeChineseFromEnd(inputString: string): string {
|
removeChineseFromEnd(inputString: string): string {
|
||||||
|
if (!inputString) {
|
||||||
|
return inputString;
|
||||||
|
}
|
||||||
const chineseRegex = /[\u4e00-\u9fa5]+$/;
|
const chineseRegex = /[\u4e00-\u9fa5]+$/;
|
||||||
const match = inputString.match(chineseRegex);
|
const match = inputString.trim().match(chineseRegex);
|
||||||
|
|
||||||
if (match && match[0]) {
|
if (match && match[0]) {
|
||||||
const chineseLength = match[0].length;
|
const chineseLength = match[0].length;
|
||||||
return inputString.slice(0, -chineseLength);
|
return this.removeChineseFromEnd(inputString.slice(0, -chineseLength));
|
||||||
}
|
}
|
||||||
|
|
||||||
return inputString;
|
return inputString;
|
||||||
}
|
}
|
||||||
/** 解析数据 */
|
/** 解析数据 */
|
||||||
|
@ -190,7 +190,7 @@ function reWriteVersion() {
|
|||||||
cocosVersion = "v3.4.+"
|
cocosVersion = "v3.4.+"
|
||||||
//cocosVersion = "v2.4.x"
|
//cocosVersion = "v2.4.x"
|
||||||
|
|
||||||
const pluginVersion = "1.0.1"; // 打包之前记得修改这里的版本号,第三位为只更新lib文件,前两位为更新整个插件。
|
const pluginVersion = "1.0.3"; // 打包之前记得修改这里的版本号,第三位为只更新lib文件,前两位为更新整个插件。
|
||||||
|
|
||||||
console.log(`打包版本号为${pluginVersion}\n记得升级版本号~\n版本规则:第三位为只更新lib文件,前两位为更新整个插件。\n调用本脚本时,会自动赋值给插件版本号`);
|
console.log(`打包版本号为${pluginVersion}\n记得升级版本号~\n版本规则:第三位为只更新lib文件,前两位为更新整个插件。\n调用本脚本时,会自动赋值给插件版本号`);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user