Delphi /Object Pascal中是否有C#字符串插值的等价物?我知道有几个Object Pascal变体,如REMObjects Oxygene和PascalABC.Net,它们都有字符串插值功能,但都是基于CLI/. Net框架的语言?C#字符串插值示例:
double a = 3; double b = 4; Console.WriteLine($"Area of {a} and {b} is {0.5 * a * b}");
bwntbbo31#
不, Delphi 或FreePascal中没有类似C# string interpolation的东西,最接近的等价物是SysUtils.Format(),例如:
SysUtils.Format()
uses ..., SysUtils; var a, b: Double; begin a := 3.0; b := 4.0; WriteLn(Format('Area of %f and %f is %f', [a, b, 0.5 * a * b])); ... end;
1条答案
按热度按时间bwntbbo31#
不, Delphi 或FreePascal中没有类似C# string interpolation的东西,最接近的等价物是
SysUtils.Format()
,例如: