F # string formatting - using the same value twice

I am trying to find the F # equivalent of the following C # snippet

string.Format("A: {0} B: {1} A again: {0} C: {2}", a, b, c);

I can do it with

sprintf "A: %s B: %s A again: %s C: %s" a b a c

However, I am wondering if there is a way to refer to property a twice, as in C #.

thank

+5
source share
1 answer

Fortunately, String.Formatit still works in F #.

> open System;;
> String.Format("Hello {0} {0}", "world");;
val it : string = "Hello world world"
+8
source

All Articles