培训
Text.Combine
Text.Combine(texts as list, optional separator as nullable text) as text
返回将文本值列表(texts
)合并为单个文本值的结果。 忽略 texts
中呈现的任何 null
值。 可以指定在最终合并文本中使用的可选 separator
。
组合文本值 "Seattle" 和 "WA"。
使用情况
Text.Combine({"Seattle", "WA"})
输出
"SeattleWA"
合并“Seattle”和“WA”文本值,用一个逗号和一个空格分隔。
使用情况
Text.Combine({"Seattle", "WA"}, ", ")
输出
"Seattle, WA"
合并“Seattle”、null
和“WA”值,用一个逗号和一个空格分隔。 (请注意,忽略 null
。)
使用情况
Text.Combine({"Seattle", null, "WA"}, ", ")
输出
"Seattle, WA"
使用情况
将名字、中间名首字母(如果有的话)和姓氏组合成个人的全名。
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"]
})