例如,在这样的代码中,
bool FileIO::ReadTextFile(const std::string &FileName, std::string &Contents) {
bool Result = false;
std::ifstream FileObj;
try {
FileObj.exceptions(std::ifstream::badbit | std::ifstream::failbit);
if (DoesFileExist(FileName)) {
FileObj.open(FileName, std::ifstream::in);
std::stringstream FileContents;
FileContents << FileObj.rdbuf();
Contents = FileContents.str();
Result = true;
}
} catch (std::exception &e) {
std::cout << "Error when reading from file : " << FileName << " "
<< std::strerror(errno) << " Exception : " << e.what()
<< std::endl;
}
我可以打印“ 1,234,567,890”之类的值吗?
答案 0 :(得分:2)
尝试一下
<button @onclick="Demo">Click</button>
<span>@stringSize</span>
@code {
long size = 1234567890;
string stringSize = "";
private void Demo()
{
stringSize = (size).ToString("#,##0.00");
}
}