跳至主要内容

Text.Combine

將文字值的清單串連成一個文字值。

Syntax

Text.Combine(
texts as list,
optional separator as text
) as text

Remarks

傳回將文字值清單 texts 結合成單一文字值的結果。會忽略 texts 中出現的任何 null 值。 可以指定在最終結合文字中使用的選用 separator

Examples

Example #1

結合文字值 "Seattle" 與 "WA"。

Text.Combine({"Seattle", "WA"})

Result:

"SeattleWA"

Example #2

結合文字值 "Seattle" 和 "WA",並以逗號和空格分隔。

Text.Combine({"Seattle", "WA"}, ", ")

Result:

"Seattle, WA"

Example #3

結合值 "Seattle"、null 和 "WA",並以逗號和空格分隔。(請注意,會忽略 null。)

Text.Combine({"Seattle", null, "WA"}, ", ")

Result:

"Seattle, WA"

Example #4

將名字、中間名 (若存在) 和姓氏合併為個人的全名。

let
Source = Table.FromRecords({
[First Name = "Doug", Middle Initial = "J", Last Name = "Elis"],
[First Name = "Anna", Middle Initial = "M", Last Name = "Jorayew"],
[First Name = "Rada", Middle Initial = null, Last Name = "Mihaylova"]
}),
FullName = Table.AddColumn(Source, "Full Name", each Text.Combine({[First Name], [Middle Initial], [Last Name]}, " "))
in
FullName

Result:

Table.FromRecords({
[First Name = "Doug", Middle Initial = "J", Last Name = "Elis", Full Name = "Doug J Elis"],
[First Name = "Anna", Middle Initial = "M", Last Name = "Jorayew", Full Name = "Anna M Jorayew"],
[First Name = "Rada", Middle Initial = null, Last Name = "Mihaylova", Full Name = "Rada Mihaylova"]
})

Category

Text.Transformations