PowerApps 中的 Split 函式Split function in PowerApps

將文字字串分割成許多子字串。Splits a text string into a table of substrings.


Split 函式可將文字字串分割成許多子字串。The Split function breaks a text string into a table of substrings. 使用 Split 可分割以逗號分隔的清單、在日期組件之間使用斜線的日期,以及適用於其他使用妥善定義之分隔符號的情況。Use Split to break up comma delimited lists, dates that use a slash between date parts, and in other situations where a well defined delimiter is used.

可以用分隔符號字串分割文字字串。A separator string is used to break the text string apart. 分隔符號可以是文字字串中整體相符的零個、一個或多個字元。The separator can be zero, one, or more characters that are matched as a whole in the text string. 使用零長度或「空白」字串會導致每個字元被單獨分開。Using a zero length or blank string results in each character being broken out individually. 在結果中不會傳回相符的分隔符號字元。The matched separator characters are not returned in the result. 如果找不到相符的分隔符號,則會傳回整個文字字串作為單一結果。If no separator match is found then the entire text string is returned as a single result.

使用 Concat 函式可重新合併字串 (沒有分隔符號)。Use the Concat function to recombine the string (without the separators).


Split( Text, Separator )Split( Text, Separator )

  • Text - 必要的。Text - Required. 要分割的文字。Text to split.
  • Separator - 必要的。Separator - Required. 用於分割字串的分隔符號。Separator to use in splitting the string. 可以是零個、一個或多個字元。Can be zero, one, or more characters.


公式Formula 說明Description 結果Result
Split( "Apples, Oranges, Bananas", "," )Split( "Apples, Oranges, Bananas", "," ) 使用逗號分隔符號,將不同的水果分開。Splits the different fruits apart, based on the comma separator. 系統只會根據逗點 (而非其後的空格) 執行分割,所以導致 " Oranges" 和 " Bananas" 的前面出現空格。The split is performed based on only the comma and not the space after it, resulting in a space at the front of " Oranges" and " Bananas".
TrimEnds( Split( "Apples, Oranges, Bananas", "," ) )TrimEnds( Split( "Apples, Oranges, Bananas", "," ) ) 如同前一個範例,但在此情況下,TrimEnds 函式會移除空格,並在 Split 所產生的單一資料行資料表上作業。Same as the previous example, but in this case the space is removed by the TrimEnds function, operating on the single column table that is produced by Split. 我們本來也可以使用分隔符號 ", " (這會在逗號之後包含空格),但如果沒有任何空格或有兩個空格,就無法正確地運作。We could have also used the separator ", " which includes the space after the comma, but that would not have worked properly if there is no space or there are two spaces.
Split( "08/28/17", "/" )Split( "08/28/17", "/" ) 使用正斜線作為分隔符號,將日期分開。Splits the date apart, using a forward slash as the separator.
Split( "Hello, World", "," )Split( "Hello, World", "," ) 使用逗號作為分隔符號,將單字分開。Splits the words apart, using a comma as the separator. 第二筆結果會以空格開頭,因為這是緊接在逗號後面的字元。The second result starts with a space since this was the character immediately following the comma.
Split( "Hello, World", "o" )Split( "Hello, World", "o" ) 使用字元 "o" 作為分隔符號,將字串分開。Splits the string apart, using the character "o" as the separator.
Split( "Hello, World", "l" )Split( "Hello, World", "l" ) 使用單一字元 "l" 作為分隔符號,將字串分開。Splits the string apart, using the single character "l" as the separator. 因為 Hello 中兩個 l 之間沒有任何字元。所以會傳回「空白」值。Since there were no characters between the two l's in Hello, a blank value was returned.
Split( "Hello, World", "ll" )Split( "Hello, World", "ll" ) 使用雙重字元 "ll" 作為分隔符號,將字串分開。Splits the string apart, using the double character "ll" as the separator.
Split( "Hello, World", "%" )Split( "Hello, World", "%" ) 使用百分比符號作為分隔符號,將字串分開。Splits the string apart, using the percent sign as the separator. 因為此分隔符號不會出現在字串中,所以會傳回整個字串作為一筆結果。Since this separator does not appear in the string, the entire string is returned as one result.
Split( "Hello, World", "" )Split( "Hello, World", "" ) 使用空字串作為分隔符號 (零個字元),將字串分開。Splits the string apart, using an empty string as the separator (zero characters). 這會將字串的每個字元分開。This will break the string on each character.