跳到主要内容

Text.Start

返回文本的开头。

Syntax

Text.Start(
text as text,
count as number
) as text

Remarks

返回 text 的前 count 个字符作为文本值。

Examples

Example #1

获取 "Hello, World" 的前 5 个字符。

Text.Start("Hello, World", 5)

Result:

"Hello"

Example #2

使用名字的前四个字符和姓氏的前三个字符创建个人的电子邮件地址。

let
Source = #table(type table [First Name = text, Last Name = text],
{
{"Douglas", "Elis"},
{"Ana", "Jorayew"},
{"Rada", "Mihaylova"}
}),
EmailAddress = Table.AddColumn(
Source,
"Email Address",
each Text.Combine({
Text.Start([First Name], 4),
Text.Start([Last Name], 3),
"@contoso.com"
})
)
in
EmailAddress

Result:

#table(type table [First Name = text, Last Name = text, Email Address = text],
{
{"Douglas", "Elis", "DougEli@contoso.com"},
{"Ana", "Jorayew", "AnaJor@contoso.com"},
{"Rada", "Mihaylova", "RadaMih@contoso.com"}
})

Category

Text.Extraction