字符串::格式有什么用. 我也没有在互联网上得到它

what is the use of string::format. i am no getting it on internet as well

本文关键字:互联网 什么 格式 字符串      更新时间:2023-10-16
void updateList(void) {
numCam = get_noofcameras_connected();
if (numCam != 0) {
CameraSelect->Text = ("Please select Camera");
CameraSelect->Items->Add("ALL");
for (int i = 1; i < numCam + 1; i++) {
CameraSelect->Items->Add(string::format("Camera {0}", i));
}
}
else {
CameraSelect->Text = ("NO CAMERA CONNECTED");
}
}

它给出的错误字符串是不明确的.

对于C#,你可以调用.Format

这里有一个例子来自

.doc

Decimal pricePerOunce = 17.36m;
String s = String.Format("The current price is {0} per ounce.",
pricePerOunce);
Console.WriteLine(s);