Apache Pig 字串函式



Apache Pig 中有以下字串函式。

序號 函式與描述
1 ENDSWITH(string, testAgainst)

驗證給定字串是否以特定子字串結尾。

2 STARTSWITH(string, substring)

接受兩個字串引數,並驗證第一個字串是否以第二個字串開頭。

3 SUBSTRING(string, startIndex, stopIndex)

從給定字串返回子字串。

4 EqualsIgnoreCase(string1, string2)

比較兩個字串,忽略大小寫。

5 INDEXOF(string, ‘character’, startIndex)

返回字串中字元的第一次出現位置,從起始索引向前搜尋。

6 LAST_INDEX_OF(expression)

返回字串中字元最後一次出現的位置,從起始索引向後搜尋。

7 LCFIRST(expression)

將字串中的第一個字元轉換為小寫。

8 UCFIRST(expression)

返回將第一個字元轉換為大寫的字串。

9 UPPER(expression)

UPPER(expression) 返回轉換為大寫的字串。

10 LOWER(expression)

將字串中的所有字元轉換為小寫。

11 REPLACE(string, ‘oldChar’, ‘newChar’);

將字串中現有的字元替換為新字元。

12 STRSPLIT(string, regex, limit)

根據給定正則表示式的匹配結果分割字串。

13 STRSPLITTOBAG(string, regex, limit)

類似於STRSPLIT()函式,它根據給定的分隔符分割字串,並將結果返回到一個bag中。

14 TRIM(expression)

返回刪除了前導和尾隨空格的字串副本。

15 LTRIM(expression)

返回刪除了前導空格的字串副本。

16 RTRIM(expression)

返回刪除了尾隨空格的字串副本。

廣告
© . All rights reserved.