amis-formula 1.2.7 → 1.2.8
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 +1 -1
- package/dist/doc.js +251 -0
- package/dist/doc.md +160 -0
- package/dist/evalutor.d.ts +160 -0
- package/dist/index.js +1410 -1
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/doc.js
CHANGED
|
@@ -320,6 +320,79 @@ export default [
|
|
|
320
320
|
},
|
|
321
321
|
namespace: "数学函数"
|
|
322
322
|
},
|
|
323
|
+
{
|
|
324
|
+
name: "DEVSQ",
|
|
325
|
+
description: "返回数据点与数据均值点之差(数据偏差)的平方和",
|
|
326
|
+
example: "DEVSQ(num1, num2, ...numN)",
|
|
327
|
+
params: [
|
|
328
|
+
{
|
|
329
|
+
type: "...number",
|
|
330
|
+
name: "num",
|
|
331
|
+
description: "要处理的数字"
|
|
332
|
+
}
|
|
333
|
+
],
|
|
334
|
+
returns: {
|
|
335
|
+
type: "number",
|
|
336
|
+
description: "所有数值的平均值"
|
|
337
|
+
},
|
|
338
|
+
namespace: "数学函数"
|
|
339
|
+
},
|
|
340
|
+
{
|
|
341
|
+
name: "AVEDEV",
|
|
342
|
+
description: "数据点到其算术平均值的绝对偏差的平均值",
|
|
343
|
+
example: "AVEDEV(num1, num2, ...numN)",
|
|
344
|
+
params: [
|
|
345
|
+
{
|
|
346
|
+
type: "...number",
|
|
347
|
+
name: "num",
|
|
348
|
+
description: "要处理的数字"
|
|
349
|
+
}
|
|
350
|
+
],
|
|
351
|
+
returns: {
|
|
352
|
+
type: "number",
|
|
353
|
+
description: "所有数值的平均值"
|
|
354
|
+
},
|
|
355
|
+
namespace: "数学函数"
|
|
356
|
+
},
|
|
357
|
+
{
|
|
358
|
+
name: "HARMEAN",
|
|
359
|
+
description: "数据点的调和平均值",
|
|
360
|
+
example: "HARMEAN(num1, num2, ...numN)",
|
|
361
|
+
params: [
|
|
362
|
+
{
|
|
363
|
+
type: "...number",
|
|
364
|
+
name: "num",
|
|
365
|
+
description: "要处理的数字"
|
|
366
|
+
}
|
|
367
|
+
],
|
|
368
|
+
returns: {
|
|
369
|
+
type: "number",
|
|
370
|
+
description: "所有数值的平均值"
|
|
371
|
+
},
|
|
372
|
+
namespace: "数学函数"
|
|
373
|
+
},
|
|
374
|
+
{
|
|
375
|
+
name: "LARGE",
|
|
376
|
+
description: "数据集中第 k 个最大值",
|
|
377
|
+
example: "LARGE(array, k)",
|
|
378
|
+
params: [
|
|
379
|
+
{
|
|
380
|
+
type: "array",
|
|
381
|
+
name: "nums",
|
|
382
|
+
description: "要处理的数字"
|
|
383
|
+
},
|
|
384
|
+
{
|
|
385
|
+
type: "number",
|
|
386
|
+
name: "k",
|
|
387
|
+
description: "第几大"
|
|
388
|
+
}
|
|
389
|
+
],
|
|
390
|
+
returns: {
|
|
391
|
+
type: "number",
|
|
392
|
+
description: "所有数值的平均值"
|
|
393
|
+
},
|
|
394
|
+
namespace: "数学函数"
|
|
395
|
+
},
|
|
323
396
|
{
|
|
324
397
|
name: "UPPERMONEY",
|
|
325
398
|
description: "将数值转为中文大写金额",
|
|
@@ -511,6 +584,128 @@ export default [
|
|
|
511
584
|
},
|
|
512
585
|
namespace: "文本函数"
|
|
513
586
|
},
|
|
587
|
+
{
|
|
588
|
+
name: "UPPERFIRST",
|
|
589
|
+
description: "将传入文本首字母转成大写",
|
|
590
|
+
example: "UPPERFIRST(text)",
|
|
591
|
+
params: [
|
|
592
|
+
{
|
|
593
|
+
type: "string",
|
|
594
|
+
name: "text",
|
|
595
|
+
description: "文本"
|
|
596
|
+
}
|
|
597
|
+
],
|
|
598
|
+
returns: {
|
|
599
|
+
type: "string",
|
|
600
|
+
description: "结果文本"
|
|
601
|
+
},
|
|
602
|
+
namespace: "文本函数"
|
|
603
|
+
},
|
|
604
|
+
{
|
|
605
|
+
name: "PADSTART",
|
|
606
|
+
description: "向前补齐文本长度\n\n示例 `PADSTART(\"6\", 2, \"0\")`\n\n返回 `06`",
|
|
607
|
+
example: "PADSTART(text)",
|
|
608
|
+
params: [
|
|
609
|
+
{
|
|
610
|
+
type: "string",
|
|
611
|
+
name: "text",
|
|
612
|
+
description: "文本"
|
|
613
|
+
},
|
|
614
|
+
{
|
|
615
|
+
type: "number",
|
|
616
|
+
name: "num",
|
|
617
|
+
description: "目标长度"
|
|
618
|
+
},
|
|
619
|
+
{
|
|
620
|
+
type: "string",
|
|
621
|
+
name: "pad",
|
|
622
|
+
description: "用于补齐的文本"
|
|
623
|
+
}
|
|
624
|
+
],
|
|
625
|
+
returns: {
|
|
626
|
+
type: "string",
|
|
627
|
+
description: "结果文本"
|
|
628
|
+
},
|
|
629
|
+
namespace: "文本函数"
|
|
630
|
+
},
|
|
631
|
+
{
|
|
632
|
+
name: "CAPITALIZE",
|
|
633
|
+
description: "将文本转成标题\n\n示例 `CAPITALIZE(\"star\")`\n\n返回 `Star`",
|
|
634
|
+
example: "CAPITALIZE(text)",
|
|
635
|
+
params: [
|
|
636
|
+
{
|
|
637
|
+
type: "string",
|
|
638
|
+
name: "text",
|
|
639
|
+
description: "文本"
|
|
640
|
+
}
|
|
641
|
+
],
|
|
642
|
+
returns: {
|
|
643
|
+
type: "string",
|
|
644
|
+
description: "结果文本"
|
|
645
|
+
},
|
|
646
|
+
namespace: "文本函数"
|
|
647
|
+
},
|
|
648
|
+
{
|
|
649
|
+
name: "ESCAPE",
|
|
650
|
+
description: "对文本进行 HTML 转义\n\n示例 `ESCAPE(\"star\")`\n\n返回 `Star`",
|
|
651
|
+
example: "ESCAPE(text)",
|
|
652
|
+
params: [
|
|
653
|
+
{
|
|
654
|
+
type: "string",
|
|
655
|
+
name: "text",
|
|
656
|
+
description: "文本"
|
|
657
|
+
}
|
|
658
|
+
],
|
|
659
|
+
returns: {
|
|
660
|
+
type: "string",
|
|
661
|
+
description: "结果文本"
|
|
662
|
+
},
|
|
663
|
+
namespace: "文本函数"
|
|
664
|
+
},
|
|
665
|
+
{
|
|
666
|
+
name: "TRUNCATE",
|
|
667
|
+
description: "对文本长度进行截断\n\n示例 `TRUNCATE(\"amis.baidu.com\", 6)`\n\n返回 `amis...`",
|
|
668
|
+
example: "TRUNCATE(text, 6)",
|
|
669
|
+
params: [
|
|
670
|
+
{
|
|
671
|
+
type: "string",
|
|
672
|
+
name: "text",
|
|
673
|
+
description: "文本"
|
|
674
|
+
},
|
|
675
|
+
{
|
|
676
|
+
type: "number",
|
|
677
|
+
name: "text",
|
|
678
|
+
description: "最长长度"
|
|
679
|
+
}
|
|
680
|
+
],
|
|
681
|
+
returns: {
|
|
682
|
+
type: "string",
|
|
683
|
+
description: "结果文本"
|
|
684
|
+
},
|
|
685
|
+
namespace: "文本函数"
|
|
686
|
+
},
|
|
687
|
+
{
|
|
688
|
+
name: "BEFORELAST",
|
|
689
|
+
description: "取在某个分隔符之前的所有字符串",
|
|
690
|
+
example: "BEFORELAST(text, '.')",
|
|
691
|
+
params: [
|
|
692
|
+
{
|
|
693
|
+
type: "string",
|
|
694
|
+
name: "text",
|
|
695
|
+
description: "文本"
|
|
696
|
+
},
|
|
697
|
+
{
|
|
698
|
+
type: "string",
|
|
699
|
+
name: "delimiter",
|
|
700
|
+
description: "结束文本"
|
|
701
|
+
}
|
|
702
|
+
],
|
|
703
|
+
returns: {
|
|
704
|
+
type: "string",
|
|
705
|
+
description: "判断结果"
|
|
706
|
+
},
|
|
707
|
+
namespace: "文本函数"
|
|
708
|
+
},
|
|
514
709
|
{
|
|
515
710
|
name: "SPLIT",
|
|
516
711
|
description: "将文本根据指定片段分割成数组\n\n示例:`SPLIT(\"a,b,c\", \",\")`\n\n返回 `[\"a\", \"b\", \"c\"]`",
|
|
@@ -550,6 +745,40 @@ export default [
|
|
|
550
745
|
},
|
|
551
746
|
namespace: "文本函数"
|
|
552
747
|
},
|
|
748
|
+
{
|
|
749
|
+
name: "STRIPTAG",
|
|
750
|
+
description: "去除文本中的 HTML 标签\n\n示例:`STRIPTAG(\"<b>amis</b>\")`\n\n返回:`amis`",
|
|
751
|
+
example: "STRIPTAG(text)",
|
|
752
|
+
params: [
|
|
753
|
+
{
|
|
754
|
+
type: "string",
|
|
755
|
+
name: "text",
|
|
756
|
+
description: "文本"
|
|
757
|
+
}
|
|
758
|
+
],
|
|
759
|
+
returns: {
|
|
760
|
+
type: "string",
|
|
761
|
+
description: "处理后的文本"
|
|
762
|
+
},
|
|
763
|
+
namespace: "文本函数"
|
|
764
|
+
},
|
|
765
|
+
{
|
|
766
|
+
name: "LINEBREAK",
|
|
767
|
+
description: "将字符串中的换行转成 HTML `<br>`,用于简单换行的场景\n\n示例:`LINEBREAK(\"\\n\")`\n\n返回:`<br/>`",
|
|
768
|
+
example: "LINEBREAK(text)",
|
|
769
|
+
params: [
|
|
770
|
+
{
|
|
771
|
+
type: "string",
|
|
772
|
+
name: "text",
|
|
773
|
+
description: "文本"
|
|
774
|
+
}
|
|
775
|
+
],
|
|
776
|
+
returns: {
|
|
777
|
+
type: "string",
|
|
778
|
+
description: "处理后的文本"
|
|
779
|
+
},
|
|
780
|
+
namespace: "文本函数"
|
|
781
|
+
},
|
|
553
782
|
{
|
|
554
783
|
name: "STARTSWITH",
|
|
555
784
|
description: "判断字符串(text)是否以特定字符串(startString)开始,是则返回 True,否则返回 False",
|
|
@@ -572,6 +801,28 @@ export default [
|
|
|
572
801
|
},
|
|
573
802
|
namespace: "文本函数"
|
|
574
803
|
},
|
|
804
|
+
{
|
|
805
|
+
name: "ENDSWITH",
|
|
806
|
+
description: "判断字符串(text)是否以特定字符串(endString)结束,是则返回 True,否则返回 False",
|
|
807
|
+
example: "ENDSWITH(text, '片段')",
|
|
808
|
+
params: [
|
|
809
|
+
{
|
|
810
|
+
type: "string",
|
|
811
|
+
name: "text",
|
|
812
|
+
description: "文本"
|
|
813
|
+
},
|
|
814
|
+
{
|
|
815
|
+
type: "string",
|
|
816
|
+
name: "endString",
|
|
817
|
+
description: "结束文本"
|
|
818
|
+
}
|
|
819
|
+
],
|
|
820
|
+
returns: {
|
|
821
|
+
type: "string",
|
|
822
|
+
description: "判断结果"
|
|
823
|
+
},
|
|
824
|
+
namespace: "文本函数"
|
|
825
|
+
},
|
|
575
826
|
{
|
|
576
827
|
name: "CONTAINS",
|
|
577
828
|
description: "判断参数 1 中的文本是否包含参数 2 中的文本。",
|
package/dist/doc.md
CHANGED
|
@@ -195,6 +195,47 @@
|
|
|
195
195
|
|
|
196
196
|
返回所有参数的平均值
|
|
197
197
|
|
|
198
|
+
### DEVSQ
|
|
199
|
+
|
|
200
|
+
用法:`DEVSQ(num1, num2, ...numN)`
|
|
201
|
+
|
|
202
|
+
* `num:...number` 要处理的数字
|
|
203
|
+
|
|
204
|
+
返回:`number` 所有数值的平均值
|
|
205
|
+
|
|
206
|
+
返回数据点与数据均值点之差(数据偏差)的平方和
|
|
207
|
+
|
|
208
|
+
### AVEDEV
|
|
209
|
+
|
|
210
|
+
用法:`AVEDEV(num1, num2, ...numN)`
|
|
211
|
+
|
|
212
|
+
* `num:...number` 要处理的数字
|
|
213
|
+
|
|
214
|
+
返回:`number` 所有数值的平均值
|
|
215
|
+
|
|
216
|
+
数据点到其算术平均值的绝对偏差的平均值
|
|
217
|
+
|
|
218
|
+
### HARMEAN
|
|
219
|
+
|
|
220
|
+
用法:`HARMEAN(num1, num2, ...numN)`
|
|
221
|
+
|
|
222
|
+
* `num:...number` 要处理的数字
|
|
223
|
+
|
|
224
|
+
返回:`number` 所有数值的平均值
|
|
225
|
+
|
|
226
|
+
数据点的调和平均值
|
|
227
|
+
|
|
228
|
+
### LARGE
|
|
229
|
+
|
|
230
|
+
用法:`LARGE(array, k)`
|
|
231
|
+
|
|
232
|
+
* `nums:array` 要处理的数字
|
|
233
|
+
* `k:number` 第几大
|
|
234
|
+
|
|
235
|
+
返回:`number` 所有数值的平均值
|
|
236
|
+
|
|
237
|
+
数据集中第 k 个最大值
|
|
238
|
+
|
|
198
239
|
### UPPERMONEY
|
|
199
240
|
|
|
200
241
|
用法:`UPPERMONEY(num)`
|
|
@@ -311,6 +352,86 @@
|
|
|
311
352
|
|
|
312
353
|
将传入文本转成大写
|
|
313
354
|
|
|
355
|
+
### UPPERFIRST
|
|
356
|
+
|
|
357
|
+
用法:`UPPERFIRST(text)`
|
|
358
|
+
|
|
359
|
+
* `text:string` 文本
|
|
360
|
+
|
|
361
|
+
返回:`string` 结果文本
|
|
362
|
+
|
|
363
|
+
将传入文本首字母转成大写
|
|
364
|
+
|
|
365
|
+
### PADSTART
|
|
366
|
+
|
|
367
|
+
用法:`PADSTART(text)`
|
|
368
|
+
|
|
369
|
+
* `text:string` 文本
|
|
370
|
+
* `num:number` 目标长度
|
|
371
|
+
* `pad:string` 用于补齐的文本
|
|
372
|
+
|
|
373
|
+
返回:`string` 结果文本
|
|
374
|
+
|
|
375
|
+
向前补齐文本长度
|
|
376
|
+
|
|
377
|
+
示例 `PADSTART("6", 2, "0")`
|
|
378
|
+
|
|
379
|
+
返回 `06`
|
|
380
|
+
|
|
381
|
+
### CAPITALIZE
|
|
382
|
+
|
|
383
|
+
用法:`CAPITALIZE(text)`
|
|
384
|
+
|
|
385
|
+
* `text:string` 文本
|
|
386
|
+
|
|
387
|
+
返回:`string` 结果文本
|
|
388
|
+
|
|
389
|
+
将文本转成标题
|
|
390
|
+
|
|
391
|
+
示例 `CAPITALIZE("star")`
|
|
392
|
+
|
|
393
|
+
返回 `Star`
|
|
394
|
+
|
|
395
|
+
### ESCAPE
|
|
396
|
+
|
|
397
|
+
用法:`ESCAPE(text)`
|
|
398
|
+
|
|
399
|
+
* `text:string` 文本
|
|
400
|
+
|
|
401
|
+
返回:`string` 结果文本
|
|
402
|
+
|
|
403
|
+
对文本进行 HTML 转义
|
|
404
|
+
|
|
405
|
+
示例 `ESCAPE("star")`
|
|
406
|
+
|
|
407
|
+
返回 `Star`
|
|
408
|
+
|
|
409
|
+
### TRUNCATE
|
|
410
|
+
|
|
411
|
+
用法:`TRUNCATE(text, 6)`
|
|
412
|
+
|
|
413
|
+
* `text:string` 文本
|
|
414
|
+
* `text:number` 最长长度
|
|
415
|
+
|
|
416
|
+
返回:`string` 结果文本
|
|
417
|
+
|
|
418
|
+
对文本长度进行截断
|
|
419
|
+
|
|
420
|
+
示例 `TRUNCATE("amis.baidu.com", 6)`
|
|
421
|
+
|
|
422
|
+
返回 `amis...`
|
|
423
|
+
|
|
424
|
+
### BEFORELAST
|
|
425
|
+
|
|
426
|
+
用法:`BEFORELAST(text, '.')`
|
|
427
|
+
|
|
428
|
+
* `text:string` 文本
|
|
429
|
+
* `delimiter:string` 结束文本
|
|
430
|
+
|
|
431
|
+
返回:`string` 判断结果
|
|
432
|
+
|
|
433
|
+
取在某个分隔符之前的所有字符串
|
|
434
|
+
|
|
314
435
|
### SPLIT
|
|
315
436
|
|
|
316
437
|
用法:`SPLIT(text, ',')`
|
|
@@ -336,6 +457,34 @@
|
|
|
336
457
|
|
|
337
458
|
将文本去除前后空格
|
|
338
459
|
|
|
460
|
+
### STRIPTAG
|
|
461
|
+
|
|
462
|
+
用法:`STRIPTAG(text)`
|
|
463
|
+
|
|
464
|
+
* `text:string` 文本
|
|
465
|
+
|
|
466
|
+
返回:`string` 处理后的文本
|
|
467
|
+
|
|
468
|
+
去除文本中的 HTML 标签
|
|
469
|
+
|
|
470
|
+
示例:`STRIPTAG("<b>amis</b>")`
|
|
471
|
+
|
|
472
|
+
返回:`amis`
|
|
473
|
+
|
|
474
|
+
### LINEBREAK
|
|
475
|
+
|
|
476
|
+
用法:`LINEBREAK(text)`
|
|
477
|
+
|
|
478
|
+
* `text:string` 文本
|
|
479
|
+
|
|
480
|
+
返回:`string` 处理后的文本
|
|
481
|
+
|
|
482
|
+
将字符串中的换行转成 HTML `<br>`,用于简单换行的场景
|
|
483
|
+
|
|
484
|
+
示例:`LINEBREAK("\n")`
|
|
485
|
+
|
|
486
|
+
返回:`<br/>`
|
|
487
|
+
|
|
339
488
|
### STARTSWITH
|
|
340
489
|
|
|
341
490
|
用法:`STARTSWITH(text, '片段')`
|
|
@@ -347,6 +496,17 @@
|
|
|
347
496
|
|
|
348
497
|
判断字符串(text)是否以特定字符串(startString)开始,是则返回 True,否则返回 False
|
|
349
498
|
|
|
499
|
+
### ENDSWITH
|
|
500
|
+
|
|
501
|
+
用法:`ENDSWITH(text, '片段')`
|
|
502
|
+
|
|
503
|
+
* `text:string` 文本
|
|
504
|
+
* `endString:string` 结束文本
|
|
505
|
+
|
|
506
|
+
返回:`string` 判断结果
|
|
507
|
+
|
|
508
|
+
判断字符串(text)是否以特定字符串(endString)结束,是则返回 True,否则返回 False
|
|
509
|
+
|
|
350
510
|
### CONTAINS
|
|
351
511
|
|
|
352
512
|
用法:`CONTAINS(text, searchText)`
|
package/dist/evalutor.d.ts
CHANGED
|
@@ -391,6 +391,47 @@ export declare class Evaluator {
|
|
|
391
391
|
* @returns {number} 所有数值的平均值
|
|
392
392
|
*/
|
|
393
393
|
fnAVG(...args: Array<any>): number;
|
|
394
|
+
/**
|
|
395
|
+
* 返回数据点与数据均值点之差(数据偏差)的平方和
|
|
396
|
+
*
|
|
397
|
+
* @example DEVSQ(num1, num2, ...numN)
|
|
398
|
+
* @param {...number} num - 要处理的数字
|
|
399
|
+
* @namespace 数学函数
|
|
400
|
+
*
|
|
401
|
+
* @returns {number} 所有数值的平均值
|
|
402
|
+
*/
|
|
403
|
+
fnDEVSQ(...args: Array<any>): number | null;
|
|
404
|
+
/**
|
|
405
|
+
* 数据点到其算术平均值的绝对偏差的平均值
|
|
406
|
+
*
|
|
407
|
+
* @example AVEDEV(num1, num2, ...numN)
|
|
408
|
+
* @param {...number} num - 要处理的数字
|
|
409
|
+
* @namespace 数学函数
|
|
410
|
+
*
|
|
411
|
+
* @returns {number} 所有数值的平均值
|
|
412
|
+
*/
|
|
413
|
+
fnAVEDEV(...args: Array<any>): number | null;
|
|
414
|
+
/**
|
|
415
|
+
* 数据点的调和平均值
|
|
416
|
+
*
|
|
417
|
+
* @example HARMEAN(num1, num2, ...numN)
|
|
418
|
+
* @param {...number} num - 要处理的数字
|
|
419
|
+
* @namespace 数学函数
|
|
420
|
+
*
|
|
421
|
+
* @returns {number} 所有数值的平均值
|
|
422
|
+
*/
|
|
423
|
+
fnHARMEAN(...args: Array<any>): number | null;
|
|
424
|
+
/**
|
|
425
|
+
* 数据集中第 k 个最大值
|
|
426
|
+
*
|
|
427
|
+
* @example LARGE(array, k)
|
|
428
|
+
* @param {array} nums - 要处理的数字
|
|
429
|
+
* @param {number} k - 第几大
|
|
430
|
+
* @namespace 数学函数
|
|
431
|
+
*
|
|
432
|
+
* @returns {number} 所有数值的平均值
|
|
433
|
+
*/
|
|
434
|
+
fnLARGE(nums: Array<any>, k: number): any;
|
|
394
435
|
/**
|
|
395
436
|
* 将数值转为中文大写金额
|
|
396
437
|
*
|
|
@@ -509,6 +550,86 @@ export declare class Evaluator {
|
|
|
509
550
|
* @returns {string} 结果文本
|
|
510
551
|
*/
|
|
511
552
|
fnUPPER(text: string): string;
|
|
553
|
+
/**
|
|
554
|
+
* 将传入文本首字母转成大写
|
|
555
|
+
*
|
|
556
|
+
* @example UPPERFIRST(text)
|
|
557
|
+
* @param {string} text - 文本
|
|
558
|
+
* @namespace 文本函数
|
|
559
|
+
*
|
|
560
|
+
* @returns {string} 结果文本
|
|
561
|
+
*/
|
|
562
|
+
fnUPPERFIRST(text: string): string;
|
|
563
|
+
/**
|
|
564
|
+
* 向前补齐文本长度
|
|
565
|
+
*
|
|
566
|
+
* 示例 `PADSTART("6", 2, "0")`
|
|
567
|
+
*
|
|
568
|
+
* 返回 `06`
|
|
569
|
+
*
|
|
570
|
+
* @example PADSTART(text)
|
|
571
|
+
* @param {string} text - 文本
|
|
572
|
+
* @param {number} num - 目标长度
|
|
573
|
+
* @param {string} pad - 用于补齐的文本
|
|
574
|
+
* @namespace 文本函数
|
|
575
|
+
*
|
|
576
|
+
* @returns {string} 结果文本
|
|
577
|
+
*/
|
|
578
|
+
fnPADSTART(text: string, num: number, pad: string): string;
|
|
579
|
+
/**
|
|
580
|
+
* 将文本转成标题
|
|
581
|
+
*
|
|
582
|
+
* 示例 `CAPITALIZE("star")`
|
|
583
|
+
*
|
|
584
|
+
* 返回 `Star`
|
|
585
|
+
*
|
|
586
|
+
* @example CAPITALIZE(text)
|
|
587
|
+
* @param {string} text - 文本
|
|
588
|
+
* @namespace 文本函数
|
|
589
|
+
*
|
|
590
|
+
* @returns {string} 结果文本
|
|
591
|
+
*/
|
|
592
|
+
fnCAPITALIZE(text: string): string;
|
|
593
|
+
/**
|
|
594
|
+
* 对文本进行 HTML 转义
|
|
595
|
+
*
|
|
596
|
+
* 示例 `ESCAPE("star")`
|
|
597
|
+
*
|
|
598
|
+
* 返回 `Star`
|
|
599
|
+
*
|
|
600
|
+
* @example ESCAPE(text)
|
|
601
|
+
* @param {string} text - 文本
|
|
602
|
+
* @namespace 文本函数
|
|
603
|
+
*
|
|
604
|
+
* @returns {string} 结果文本
|
|
605
|
+
*/
|
|
606
|
+
fnESCAPE(text: string): string;
|
|
607
|
+
/**
|
|
608
|
+
* 对文本长度进行截断
|
|
609
|
+
*
|
|
610
|
+
* 示例 `TRUNCATE("amis.baidu.com", 6)`
|
|
611
|
+
*
|
|
612
|
+
* 返回 `amis...`
|
|
613
|
+
*
|
|
614
|
+
* @example TRUNCATE(text, 6)
|
|
615
|
+
* @param {string} text - 文本
|
|
616
|
+
* @param {number} text - 最长长度
|
|
617
|
+
* @namespace 文本函数
|
|
618
|
+
*
|
|
619
|
+
* @returns {string} 结果文本
|
|
620
|
+
*/
|
|
621
|
+
fnTRUNCATE(text: string, length: number): string;
|
|
622
|
+
/**
|
|
623
|
+
* 取在某个分隔符之前的所有字符串
|
|
624
|
+
*
|
|
625
|
+
* @example BEFORELAST(text, '.')
|
|
626
|
+
* @param {string} text - 文本
|
|
627
|
+
* @param {string} delimiter - 结束文本
|
|
628
|
+
* @namespace 文本函数
|
|
629
|
+
*
|
|
630
|
+
* @returns {string} 判断结果
|
|
631
|
+
*/
|
|
632
|
+
fnBEFORELAST(text: string, delimiter?: string): string;
|
|
512
633
|
/**
|
|
513
634
|
* 将文本根据指定片段分割成数组
|
|
514
635
|
*
|
|
@@ -534,6 +655,34 @@ export declare class Evaluator {
|
|
|
534
655
|
* @returns {string} 处理后的文本
|
|
535
656
|
*/
|
|
536
657
|
fnTRIM(text: string): string;
|
|
658
|
+
/**
|
|
659
|
+
* 去除文本中的 HTML 标签
|
|
660
|
+
*
|
|
661
|
+
* 示例:`STRIPTAG("<b>amis</b>")`
|
|
662
|
+
*
|
|
663
|
+
* 返回:`amis`
|
|
664
|
+
*
|
|
665
|
+
* @example STRIPTAG(text)
|
|
666
|
+
* @param {string} text - 文本
|
|
667
|
+
* @namespace 文本函数
|
|
668
|
+
*
|
|
669
|
+
* @returns {string} 处理后的文本
|
|
670
|
+
*/
|
|
671
|
+
fnSTRIPTAG(text: string): string;
|
|
672
|
+
/**
|
|
673
|
+
* 将字符串中的换行转成 HTML `<br>`,用于简单换行的场景
|
|
674
|
+
*
|
|
675
|
+
* 示例:`LINEBREAK("\n")`
|
|
676
|
+
*
|
|
677
|
+
* 返回:`<br/>`
|
|
678
|
+
*
|
|
679
|
+
* @example LINEBREAK(text)
|
|
680
|
+
* @param {string} text - 文本
|
|
681
|
+
* @namespace 文本函数
|
|
682
|
+
*
|
|
683
|
+
* @returns {string} 处理后的文本
|
|
684
|
+
*/
|
|
685
|
+
fnLINEBREAK(text: string): string;
|
|
537
686
|
/**
|
|
538
687
|
* 判断字符串(text)是否以特定字符串(startString)开始,是则返回 True,否则返回 False
|
|
539
688
|
*
|
|
@@ -545,6 +694,17 @@ export declare class Evaluator {
|
|
|
545
694
|
* @returns {string} 判断结果
|
|
546
695
|
*/
|
|
547
696
|
fnSTARTSWITH(text: string, search: string): boolean;
|
|
697
|
+
/**
|
|
698
|
+
* 判断字符串(text)是否以特定字符串(endString)结束,是则返回 True,否则返回 False
|
|
699
|
+
*
|
|
700
|
+
* @example ENDSWITH(text, '片段')
|
|
701
|
+
* @param {string} text - 文本
|
|
702
|
+
* @param {string} endString - 结束文本
|
|
703
|
+
* @namespace 文本函数
|
|
704
|
+
*
|
|
705
|
+
* @returns {string} 判断结果
|
|
706
|
+
*/
|
|
707
|
+
fnENDSWITH(text: string, search: string): boolean;
|
|
548
708
|
/**
|
|
549
709
|
* 判断参数 1 中的文本是否包含参数 2 中的文本。
|
|
550
710
|
*
|