mingyang_text 2023.8.26 → 2025.8.6
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/README.md +8 -3
- package/package.json +1 -1
- package/text.js +86 -11
package/README.md
CHANGED
|
@@ -12,8 +12,13 @@
|
|
|
12
12
|
> * 优化了字符串配对函数的参数顺序并增加了默认值
|
|
13
13
|
> * optimized the parameter order of string pairing function and added default values
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
> *
|
|
15
|
+
* 2025-06-27
|
|
16
|
+
> * 增加了一个查找连续数字的函数
|
|
17
|
+
> * a function for finding consecutive numbers has been added
|
|
18
|
+
|
|
19
|
+
* 2025-08-06
|
|
20
|
+
> * TimeID函数增加了Date参数
|
|
21
|
+
> * the TimeID function has added a Date parameter
|
|
17
22
|
---
|
|
18
23
|
|
|
19
24
|
<br>
|
|
@@ -23,5 +28,5 @@
|
|
|
23
28
|
* fujun wang(wang.fu.jun@qq.com)
|
|
24
29
|
* Wangjing Beijing China
|
|
25
30
|
* origin of the name : mingyang is my son's name
|
|
26
|
-
* last modified :
|
|
31
|
+
* last modified : 2025-08-06
|
|
27
32
|
---
|
package/package.json
CHANGED
package/text.js
CHANGED
|
@@ -148,40 +148,47 @@ module.exports.do_Filter = func_Filter;
|
|
|
148
148
|
|
|
149
149
|
/**
|
|
150
150
|
* 返回一个36位的时间在左侧的UUID
|
|
151
|
+
* @param {"日期对象,可以为null"} args_Date
|
|
151
152
|
*/
|
|
152
|
-
function func_TimeID_36() {
|
|
153
|
-
return func_TimeID(36);
|
|
153
|
+
function func_TimeID_36(args_Date) {
|
|
154
|
+
return func_TimeID(args_Date, 36);
|
|
154
155
|
}
|
|
155
156
|
module.exports.do_TimeID_36 = func_TimeID_36;
|
|
156
157
|
|
|
157
158
|
/**
|
|
158
159
|
* 返回一个32位的时间在左侧的UUID
|
|
160
|
+
* @param {"日期对象,可以为null"} args_Date
|
|
159
161
|
*/
|
|
160
|
-
function func_TimeID_32() {
|
|
161
|
-
return func_TimeID(32);
|
|
162
|
+
function func_TimeID_32(args_Date) {
|
|
163
|
+
return func_TimeID(args_Date, 32);
|
|
162
164
|
}
|
|
163
165
|
module.exports.do_TimeID_32 = func_TimeID_32;
|
|
164
166
|
|
|
165
167
|
/**
|
|
166
168
|
* 返回一个36位的时间在左侧的UUID
|
|
169
|
+
* @param {"日期对象,可以为null"} args_Date
|
|
167
170
|
*/
|
|
168
|
-
function func_TimeNo_36() {
|
|
169
|
-
return func_TimeID(36, "0123456789");
|
|
171
|
+
function func_TimeNo_36(args_Date) {
|
|
172
|
+
return func_TimeID(args_Date, 36, "0123456789");
|
|
170
173
|
}
|
|
171
174
|
module.exports.do_TimeNo_36 = func_TimeNo_36;
|
|
172
175
|
|
|
173
176
|
/**
|
|
174
177
|
* 返回一个32位的时间在左侧的UUID
|
|
178
|
+
* @param {"日期对象,可以为null"} args_Date
|
|
175
179
|
*/
|
|
176
|
-
function func_TimeNo_32() {
|
|
177
|
-
return func_TimeID(32, "0123456789");
|
|
180
|
+
function func_TimeNo_32(args_Date) {
|
|
181
|
+
return func_TimeID(args_Date, 32, "0123456789");
|
|
178
182
|
}
|
|
179
183
|
module.exports.do_TimeNo_32 = func_TimeNo_32;
|
|
180
184
|
|
|
181
185
|
/**
|
|
182
186
|
* 返回一个时间在左侧的UUID
|
|
187
|
+
* @param {"日期对象,可以为null"} args_Date
|
|
188
|
+
* @param {"目标长度,必须是数字"} args_Digit
|
|
189
|
+
* @param {"补位字符,可以为null"} args_PlaceHolder
|
|
183
190
|
*/
|
|
184
|
-
function func_TimeID(args_Digit, args_PlaceHolder) {
|
|
191
|
+
function func_TimeID(args_Date, args_Digit, args_PlaceHolder) {
|
|
185
192
|
let temp_List = new Array(args_Digit);
|
|
186
193
|
|
|
187
194
|
//let temp_PlaceHolder = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"];
|
|
@@ -191,7 +198,7 @@ function func_TimeID(args_Digit, args_PlaceHolder) {
|
|
|
191
198
|
temp_PlaceHolder = args_PlaceHolder;
|
|
192
199
|
}
|
|
193
200
|
|
|
194
|
-
let temp_Time = func_DateTimeToString(
|
|
201
|
+
let temp_Time = func_DateTimeToString(args_Date, "yyyy-MMdd-HHmmss-fff");
|
|
195
202
|
for (let i = 0; i < temp_Time.length; i++) {
|
|
196
203
|
temp_List[i] = temp_Time[i];
|
|
197
204
|
}
|
|
@@ -676,4 +683,72 @@ function func_PairText
|
|
|
676
683
|
}
|
|
677
684
|
return [-1, args_Missing];
|
|
678
685
|
}
|
|
679
|
-
module.exports.do_PairText = func_PairText;
|
|
686
|
+
module.exports.do_PairText = func_PairText;
|
|
687
|
+
|
|
688
|
+
|
|
689
|
+
|
|
690
|
+
|
|
691
|
+
|
|
692
|
+
/**
|
|
693
|
+
* 判断一个字符是否是数字
|
|
694
|
+
*/
|
|
695
|
+
function func_IsNumber(args_Char) {
|
|
696
|
+
if (
|
|
697
|
+
(args_Char == "0")
|
|
698
|
+
||
|
|
699
|
+
(args_Char == "1")
|
|
700
|
+
||
|
|
701
|
+
(args_Char == "2")
|
|
702
|
+
||
|
|
703
|
+
(args_Char == "3")
|
|
704
|
+
||
|
|
705
|
+
(args_Char == "4")
|
|
706
|
+
||
|
|
707
|
+
(args_Char == "5")
|
|
708
|
+
||
|
|
709
|
+
(args_Char == "6")
|
|
710
|
+
||
|
|
711
|
+
(args_Char == "7")
|
|
712
|
+
||
|
|
713
|
+
(args_Char == "8")
|
|
714
|
+
||
|
|
715
|
+
(args_Char == "9")
|
|
716
|
+
) {
|
|
717
|
+
return true;
|
|
718
|
+
}
|
|
719
|
+
else {
|
|
720
|
+
return false;
|
|
721
|
+
}
|
|
722
|
+
}
|
|
723
|
+
module.exports.do_IsNumber = func_IsNumber;
|
|
724
|
+
|
|
725
|
+
|
|
726
|
+
|
|
727
|
+
|
|
728
|
+
|
|
729
|
+
/**
|
|
730
|
+
* 找出连续的数字
|
|
731
|
+
* @param {字符串} args_String
|
|
732
|
+
*/
|
|
733
|
+
function func_ConsecutiveNumbers(args_String) {
|
|
734
|
+
let temp_Array = [];
|
|
735
|
+
let temp_LastI = 0;
|
|
736
|
+
let temp_Strin = "";
|
|
737
|
+
for (let i = 0; i < args_String.length; i++) {
|
|
738
|
+
if (func_IsNumber(args_String[i]) == false) {
|
|
739
|
+
if ((i > 0) && (func_IsNumber(args_String[i - 1]) == true)) {
|
|
740
|
+
temp_Strin = args_String.substring(temp_LastI, i);
|
|
741
|
+
temp_Array.push(temp_Strin);
|
|
742
|
+
}
|
|
743
|
+
temp_LastI = i + 1;
|
|
744
|
+
}
|
|
745
|
+
else {
|
|
746
|
+
if (i == args_String.length - 1) {
|
|
747
|
+
temp_Strin = args_String.substring(temp_LastI);
|
|
748
|
+
temp_Array.push(temp_Strin);
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
}
|
|
752
|
+
return temp_Array;
|
|
753
|
+
}
|
|
754
|
+
module.exports.do_ConsecutiveNumbers = func_ConsecutiveNumbers;
|