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