Condividi tramite


Text.Format

Sintassi

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

Informazioni su

Restituisce testo formattato che viene creato applicando arguments da un elenco o record a una stringa di formato formatString. Facoltativamente è possibile specificare anche un elemento culture, ad esempio, "en-US".

Esempio 1

Formattare un elenco di numeri.

Utilizzo

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

Output

"17, 7, and 22."

Esempio 2

Formattare vari tipi di dati di un record secondo la cultura inglese degli Stati Uniti.

Utilizzo

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"
)

Output

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