c# - 如何在双引号内转义引号?
问题描述
我正在添加一个带有 html 的表格:
string _table = @"{
""version"": {""number"": 2},
""type"":""page"",
""title"":""Table"",
""space"":{""key"":""" + postdata.key + @"""},
""body"":{""storage"":{""value"":""<table><tbody><tr><th><p><strong>Project Basic Informations</strong></p></th></tr></tbody></table>"",""representation"":""storage""}}
}";
而且我想设置样式<th>
,colspan="2"
因此标题跨越两列。
我尝试了以下方法,但它不起作用:
""<table> <tbody> <tr> <th colspan=""2""> <p><strong>Project Basic Informations</strong></p> </th>....""
或<th colspan=\"2\"
有没有办法逃避双引号并让<th>
colspan 属性起作用?
解决方案
HTML 属性上的单引号也可以。你可以写<th colspan='2'>
推荐阅读
- c++ - 按地址访问变量
- python - 计算 delta-v 给出否定结果
- node.js - 使用调度程序播放音频时的 Discord.js 音乐机器人“TypeError”
- spring-kafka - 带有 @KafkaListener 注释的 kafka 消费者如何处理 max.poll.records
- reactjs - 在生产中找不到 React Router 投掷页面
- macos - 通过 MacOS High Sierra 中的终端以编程方式更改触摸栏设置
- python - 在 AWS SageMaker 上导入 fbprophet
- amazon-web-services - 从 lambda AWS 使用时 Dynamodb 没有响应
- python - 如何在 Omxplayer 上创建曲目列表
- python - 从 JSON 中提取粗体文本