type User =
{
id : int
name : string
created : DateTime
}
with
interface IFormattable with
member x.ToString (format, provider) =
sprintf "id => %i, name => %s, created => %A" x.id x.name (x.created.ToShortDateString())
let foo = { id = 999; name = "foo"; created = DateTime.Now}
let nl = Environment.NewLine + Environment.NewLine
Formatting.format (Parser.parse "{0} {1} {$0} {1} {@0}") [| foo; nl |]
output:
> Formatting.format (Parser.parse "{0} {1} {$0} {1} {@0}") [| foo; nl |]
val it : string =
""{id = 999;
name = \"foo\";
created = 11/3/2017 7:54:35 PM;}" "
" "{id = 999;
name = \"foo\";
created = 11/3/2017 7:54:35 PM;}" "
" "{id = 999;
name = \"foo\";
created = 11/3/2017 7:54:35 PM;}""
hi, do we support template like this ? "{0} {1} {$0} {1} {@0}"
output:
hi, do we support template like this ?
"{0} {1} {$0} {1} {@0}"