Format String

‘Create a var. named price that will be formatted as a currency
Dim price as Double = 3.1
Dim s as String ‘create a string

s = String.Format(“{0:c}”, price)

‘Create a var. named rightNow and set it to the current date/time
Dim rightNow as DateTime = DateTime.Now
Dim s as String ‘create a string
s = rightNow.ToString(“MMM dd, yyyy”)

s = String.Format(“{0:c} on {1:d}”, price, rightNow)
would display:
$3.10 on 1/30/02

(String.Format(“{0:0.00}”, TempoMedio))

devolve: 15,25

Deixe um comentário

O seu endereço de email não será publicado. Campos obrigatórios marcados com *