Blazor:使用@variable在页面上打印值时,可以添加千位分隔符吗?

例如,在这样的代码中,

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”之类的值吗?

jhyk6922 回答:Blazor:使用@variable在页面上打印值时,可以添加千位分隔符吗?

尝试一下

<button @onclick="Demo">Click</button>
<span>@stringSize</span>

@code {

    long  size = 1234567890;
    string stringSize = "";

    private void Demo()
    { 
        stringSize = (size).ToString("#,##0.00");
    }

}
本文链接:https://www.f2er.com/3053110.html

大家都在问