次の方法で共有


Text.Format

構文

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

バージョン情報

リストまたはレコードから書式指定文字列formatStringargumentsを適用して作成された書式設定されたテキストを返します。 省略可能な 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."