gpt4 book ai didi

css - 我如何将 HTML 转换为 string.Format

转载 作者:太空宇宙 更新时间:2023-11-04 12:53:17 25 4
gpt4 key购买 nike

我有 HTML 中的基本代码,我想将此代码转换为字符串格式。

<table id="rounded-corner" summary="2007 Major IT Companies' Profit" style="text-align: center">
<thead>
<tr>
<th scope="col" class="rounded-company"></th>
<th scope="col" class="rounded">Název</th>
<th scope="col" class="rounded">Web</th>
<th scope="col" class="rounded">Popis</th>
<th scope="col" class="rounded">Edit</th>
<th scope="col" class="rounded-q4">Delete</th>
</tr>
</thead>
<tbody>

我希望这个 HTML 用于 string.Format。

StringBuilder data = new StringBuilder();
data.Append(string.Format(@"<table id="rounded-corner" summary="2007 Major IT Companies' Profit" style="text-align: center">
<thead>
<tr>
<th scope="col" class="rounded-company"></th>
<th scope="col" class="rounded">Název</th>
<th scope="col" class="rounded">Web</th>
<th scope="col" class="rounded">Popis</th>
<th scope="col" class="rounded">Edit</th>
<th scope="col" class="rounded-q4">Delete</th>
</tr>
</thead>
<tbody>"));

我对 string.Format 的这个符号 ""有疑问,你能帮我看看我该怎么做吗?

最佳答案

你需要像这样放置\":

string.Format(@"<table id=\"rounded-corner\" summary=\"2007 Major IT Companies' Profit\" style=\"text-align: center\">
<thead>
<tr>
<th scope=\"col\" class=\"rounded-company\"></th>
<th scope=\"col\" class=\"rounded\">Název</th>
<th scope=\"col\" class=\"rounded\">Web</th>
<th scope=\"col\" class=\"rounded\">Popis</th>
<th scope=\"col\" class=\"rounded\">Edit</th>
<th scope=\"col\" class=\"rounded-q4\">Delete</th>
</tr>
</thead>
<tbody>")

或者你可以像这样拥有':

string.Format(@"<table id='rounded-corner' summary='2007 Major IT Companies Profit' style='text-align: center'>
<thead>
<tr>
<th scope='col' class='rounded-company'></th>
<th scope='col' class='rounded'>Název</th>
<th scope='col' class='rounded'>Web</th>
<th scope='col' class='rounded'>Popis</th>
<th scope='col' class='rounded'>Edit</th>
<th scope='col' class='rounded-q4'>Delete</th>
</tr>
</thead>
<tbody>")

关于css - 我如何将 HTML 转换为 string.Format,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26010245/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com