string scss = @"<style type=""text/css"">
body{
margin-left: {0}px;
margin-top: {1}px;
}
</style>";
scss = string.Format(scss, marginleft, margintop);

调试时提示string.Format格式错误,不太明白,后来将{}也作为修改字符串

        public void AddcssBody(int marginleft=,int margintop=)
{
string scss = @"<style type=""text/css"">
body{2}
margin-left: {0}px;
margin-top: {1}px;
{3}
</style>";
scss = string.Format(scss, marginleft, margintop, "{", "}");
Headary.Add(scss);
}

正确显示.

string.Format 中不能包含{}字符串的更多相关文章

  1. bat 判断变量字符串中是否包含字符串

    bat 判断变量字符串中是否包含字符串 @echo off rem way 1 set str=machine-order-service set matchStr=orderd echo %str% ...

  2. JAVA中String.format的用法 格式化字符串,格式化数字,日期时间格式化,

    1.对整数进行格式化:%[index$][标识][最小宽度]转换方式        我们可以看到,格式化字符串由4部分组成,其中%[index$]的含义我们上面已经讲过,[最小宽度]的含义也很好理解, ...

  3. js String对象中常用方法小结(字符串操作)

    1.charCodeAt方法返回一个整数,代表指定位置字符的Unicode编码. strObj.charCodeAt(index) 说明: index将被处理字符的从零开始计数的编号.有效值为0到字符 ...

  4. strstr() strpos() 获取db报错,判断报错中是否包含字符串,判断错误类型

    model中直接获取添加公司的错误.(公司名称不能重复) $enterprise_id = $this->add($enterprisedata ); $err = $this->getD ...

  5. string Format转义大括号:输入字符串的格式不正确。

    String.Format("{0} world!","hello") //将输出 hello world!,没有问题,但是只要在第一个参数的任意位置加上一个大 ...

  6. IDA 在string窗口中显示中文字符串

    打开ida61\cfg中的ida.cfg文件找到 // (cp866 version)AsciiStringChars = "\r\n\a\v\b\t\x1B" " !\ ...

  7. 测试String.Format中的Format参数

    DateTime datetime = DateTime.Now; Console.WriteLine(String.Format("{0:d}", datetime)); // ...

  8. C语言中的string.h中的内存字符串处理函数

    转载请注明出处:http://blog.csdn.net/zhubin215130/article/details/8993403 void *memcpy(void *dest, const voi ...

  9. java判断string数组中是否包含某个元素

随机推荐

  1. [Angular] Modify User Provided UI with Angular Content Directives

    If we’re going to make our toggle accessible, we’ll need to apply certain aria attributes to the con ...

  2. USACO castle

    <pre name="code" class="cpp"><pre>USER: Kevin Samuel [kevin_s1] TASK ...

  3. graph driver-device mapper-03thin pool基本操作

    // 在thin pool中创建一个新thin device // 调用路径:driver.Create() 1.1 func (devices *DeviceSet) AddDevice(hash, ...

  4. windows内存管理的机制以及优缺点

    分页存储管理基本思想:用户程序的地址空间被划分成若干固定大小的区域,称为“页”,相应地,内存空间分成若干个物理块,页和块的大小相等.可将用户程序的任一页放在内存的任一块中,实现了离散分配. 分段存储管 ...

  5. 在Orchard CMS Theme 用代码定义布局Widgets

    因为公司业务需要,经过本人几个月尝试,使用Orchard CMS 开发一个简单的企业门户(地址是http://www.ubof.cn).在刚开始接触Orchard CMS,对于个性化的网页布局不知道怎 ...

  6. leetcode 664. Strange Printer

    There is a strange printer with the following two special requirements: The printer can only print a ...

  7. Lightoj 1002 - Country Roads(prim算法)

    I am going to my home. There are many cities and many bi-directional roads between them. The cities ...

  8. HDU1166 敌兵布阵 —— 线段树单点修改

    题目链接:https://vjudge.net/problem/HDU-1166 C国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了.A国在海岸线沿直线布 ...

  9. YTU 2555: 老大的烦恼

    2555: 老大的烦恼 时间限制: 1 Sec  内存限制: 128 MB 提交: 176  解决: 47 题目描述 万恶的小黑,布置了一道题给老大做:给你一个n位的数,现在要求 你随意删除m位后,任 ...

  10. Goland软件使用教程(一)

    Goland软件使用教程(一)      Goland是由JetBrains公司旨在为go开发者提供的一个符合人体工程学的新的商业IDE.这个IDE整合了IntelliJ平台的有关go语言的编码辅助功 ...