共用方式為


Text.Combine

語法

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

關於

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

範例 1

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

使用方式

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

輸出

"SeattleWA"

範例 2

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

使用方式

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

輸出

"Seattle, WA"

範例 3

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

使用方式

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

輸出

"Seattle, WA"

範例 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

輸出

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"]
})