当前位置:网站首页>Maxcompute string splitting function -split_ PART
Maxcompute string splitting function -split_ PART
2022-07-03 08:00:00 【The dawn of victory】
Grammar format
string split_part(string <str>, string <separator>, bigint <start>[, bigint <end>])
Function description
According to the separator separator Split string str, Return from start Part to end Substring of part ( Closed interval ).
Parameter description
- str: Required .STRING type . The string to be split . If it is BIGINT、DOUBLE、DECIMAL or DATETIME type , Will be implicitly converted to STRING Participate in the operation after type .
- separator: Required .STRING Type constant . Separator for splitting , It can be a character , It can also be a string .
- start: Required .BIGINT Type constant , Must be greater than 0. Indicates the start number of the returned segment ( from 1 Start ).
- end:BIGINT Type constant , Greater than or equal to start. Indicates the end number of the returned segment , Omission , By default, it means and start The values are equal , return start Specified segment .
Return value description
return STRING type . The return rule is as follows :
- If start The value of is greater than the actual number of segments after segmentation , For example, there is 6 A fragment ,start Greater than 6, Return to empty string .
- If separator There is no in str in , And start Designated as 1, Back to the whole str. If str For the empty string , Then an empty string is output .
- If separator For the empty string , Return the original string str.
- If end Greater than the number of fragments , Return from start The starting substring .
- str Not STRING、BIGINT、DOUBLE、DECIMAL or DATETIME Type , Return error .
- separator Not STRING Type constant , Return error .
- start or end Not BIGINT Type constant , Return error .
- except separator Outside , If any parameter value is NULL, return NULL.
Examples of use
Example 1: According to the separator , Split string a,b,c,d, Returns the substring of the specified part . An example command is as follows .
-- return a.
select split_part('a,b,c,d', ',', 1);
-- return a,b.
select split_part('a,b,c,d', ',', 1, 2);
Example 2:start The value of is greater than the actual number of segments after segmentation . An example command is as follows .
-- Return to empty string .
select split_part('a,b,c,d', ',', 10);
Example 3:separator There is no in str in . An example command is as follows .
-- return a,b,c,d.
select split_part('a,b,c,d', ':', 1);
-- Return to empty string .
select split_part('a,b,c,d', ':', 2);
Example 4:separator For the empty string . An example command is as follows .
-- return a,b,c,d.
select split_part('a,b,c,d', '', 1);
Example 5:end The value of is greater than the actual number of segments after segmentation . An example command is as follows .
-- return b,c,d.
select split_part('a,b,c,d', ',', 2, 6);
Example 6: except separator Outside , Any input parameter is NULL. An example command is as follows .
-- return NULL.
select split_part('a,b,c,d', ',', null);
边栏推荐
- STM32F103 SPI (pit Diary)
- Redis batch startup and shutdown script
- P2622 light off problem II (state compression search)
- 华为交换机:配置telnet和ssh、web访问
- How can entrepreneurial teams implement agile testing to improve quality and efficiency? Voice network developer entrepreneurship lecture Vol.03
- Generate video using clipout in viz engine
- regular expression
- Huawei switch: configure Telnet, SSH and web access
- A tunnel to all ports of the server
- oracle中的 (+)是什么意思
猜你喜欢

Research shows that breast cancer cells are more likely to enter the blood when patients sleep

Open the influence list of "National Meteorological Short Videos (Kwai, Tiktok) in November" in an interactive way“

一个实习生的CnosDB之旅

IP production stream is so close to me

C language learning notes (mind map)

My touch screen production "brief history" 2

How can entrepreneurial teams implement agile testing to improve quality and efficiency? Voice network developer entrepreneurship lecture Vol.03

【LeetCode】3. Merge two sorted lists · merge two ordered linked lists

【LeetCode】2. Valid parentheses · valid parentheses

the installer has encountered an unexpected error installing this package
随机推荐
Enter three times and guess a number
Unity XR realizes interaction (grasping, moving, rotating, transmitting, shooting) -pico
Huawei switch console password reset, device initialization, default password
the installer has encountered an unexpected error installing this package
[untitled]
Pat class a 1028 list sorting
What is definition? What is a statement? What is the difference between them?
Demonstration of plug-in use of ventuz basic series
Yolo series --- xml2txt script
[cocos creator] Click the button to switch the interface
[MySQL 11] how to solve the case sensitive problem of MySQL 8.0.18
[end of 2021] National Meteorological Short Video (Kwai, Tiktok) influence list in December
链式长取值
What to do after the browser enters the URL
oracle中的 (+)是什么意思
s7700设备如何清除console密码
How can entrepreneurial teams implement agile testing to improve quality and efficiency? Voice network developer entrepreneurship lecture Vol.03
华为S5700交换机初始化和配置telnet,ssh用户方法
WPF:解决MaterialDesign:DialogHost 无法关闭问题
The difference between hdmi2.1 and hdmi2.0 and the conversion of PD signals.