Text.Format

语法

Text.Format(formatString as text, arguments as any, optional culture as nullable text) as text

关于

返回通过将来自列表或记录的 arguments 应用于格式字符串 formatString 创建的格式化文本。 还可以提供可选 culture(例如“en-US”)。

示例 1

设置数字列表的格式。

使用情况

Text.Format("#{0}, #{1}, and #{2}.", {17, 7, 22})

输出

"17, 7, and 22."

示例 2

根据美国英语区域性设置记录中的不同数据类型的格式。

使用情况

Text.Format(
    "The time for the #[distance] km run held in #[city] on #[date] was #[duration].",
    [
        city = "Seattle",
        date = #date(2015, 3, 10),
        duration = #duration(0, 0, 54, 40),
        distance = 10
    ],
    "en-US"
)

输出

"The time for the 10 km run held in Seattle on 3/10/2015 was 00:54:40."