国产精品,日韩av,hdsexvideos中国少妇,xxxxx性bbbbb欧美熟妇,波多野结衣乳巨码无在线,国产成人亚洲精品乱码

自定義函數-Fx.utils

2020-12-29 10:14:00 1305 本站

      Fx.utils:工具類相關的API

1、從html中提取純文本-htmlParseText

     定義:Fx.utils.htmlParseText(<String html>)

參數說明
html提取html內容

     data返回值類型:Stirng(提取后的文本)

     例:

def ret = Fx.utils.htmlParseText('<div class="drop-content-item"><div class="drop-box"> <div class="drop-box-item drop-box-item2" style="border: none"><p><img class="img-icon"style="width:20px;"src="https://www.fxiaoke.com/ap/wp-content/uploads/2020/05/icon-live.png"><ahref="/ap/live/">直播視頻</a></p><span>RM公開課、CRM使用技巧、數字化轉型策略及行業(yè)應用最新實踐等視頻內容</span></div>')

2、漢字轉拼音-toPinyin

     定義:Fx.utils.toPinyin(<String chinese>)

參數說明
chinese漢字

     data返回值類型:Stirng(漢字的拼音)

     例:

def ret = Fx.utils.toPinyin("測試");

3、數組拆分-listPartition

     定義:Fx.utils.listPartition(<List list>,<int size>)

參數說明
list拆分的數組
size拆分后每個數組的長度

     data返回值類型:List(按照指定大小拆分的數組集合)      返回值例:

[[1,2,3,],[4,5,6],[7,8,9]]

     調用例: List original = [1,2,3,4,5,6,7,8,9] List partition = Fx.utils.listPartition(original,3)


4、字符串轉byte數組/byte數組轉字符串-toUTF8Bytes/toUTF8String

  • 字符串轉byte數組:Fx.utils.toUTF8Bytes(String content)

  • byte數組轉字符串:Fx.utils.toUTF8String(byte[] bytes)

     data返回值類型:String

     例:

byte[] bytes = Fx.utils.toUTF8Bytes("測試")
String content = Fx.utils.toUTF8String(bytes)

5、返回指定年月的天數-daysInMonth

  •  定義:Fx.utils.daysInMonth(<Integer Year>,<Integer Month>)

     data返回值類型:Integer

     例:

Fx.utils.daysInMonth(2020,2) //返回29

6、返回指定年是否是閏年isLeapYear

  •  定義:Fx.utils.isLeapYear(<Integer Year>)

     data返回值類型:Boolean

     例:

Fx.utils.isLeapYear(2020) //返回true

7、獲取終端的請求來源-getRequestSource

  •  定義:Fx.utils.getRequestSource()

     data返回值類型:終端名稱

     例:

```
//獲取函數執(zhí)行時的來源,返回一個字符串
String source = Fx.utils.getRequestSource()
//Android 安卓
//IOS   ios
//WX   微信
//WEB   網頁
//FSBrowser 分享客戶端
//如果查詢不到返回空字符串(例如流程后面),目前只能在終端直接觸發(fā)函數時可以獲取到(例如點擊按鈕)
```



部分內容來源于互聯網,如有侵權,請聯系客服刪除處理。
在線咨詢 撥打電話