Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试找到以下 C# 片段的 F# 等效项
string.Format("A: {0} B: {1} A again: {0} C: {2}", a, b, c);
我可以这样做:
sprintf "A: %s B: %s A again: %s C: %s" a b a c
但是,我想知道是否有任何方法可以像 C# 示例中那样两次引用 a 属性。
谢谢
幸运的是String.Format仍然可以在 F# 中使用。
String.Format
> open System;; > String.Format("Hello {0} {0}", "world");; val it : string = "Hello world world"