multi_search_all_positions
Description
Syntax
ARRAY<INT> multi_search_all_positions(VARCHAR haystack, ARRAY<VARCHAR> needles)
搜索字符串 haystack
中的子字符串 needles
,并返回在 haystack
中找到的相应 needles
的位置数组。位置的下标从 1 开始。
example
mysql> select multi_search_all_positions('Hello, World!', ['hello', '!', 'world']);
+----------------------------------------------------------------------+
| multi_search_all_positions('Hello, World!', ['hello', '!', 'world']) |
+----------------------------------------------------------------------+
| [0,13,0] |
+----------------------------------------------------------------------+
mysql> select multi_search_all_positions('abc', ['a', 'bc', 'd']);
+-----------------------------------------------------+
| multi_search_all_positions('abc', ['a', 'bc', 'd']) |
+-----------------------------------------------------+
| [1,2,0] |
+-----------------------------------------------------+
keywords
MULTI_SEARCH,SEARCH,POSITIONS