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 之间没有任何字符,因此返回值 blank。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.