AN学习

1.定位字符串:IndexOf

string str1 = "abcd";
int positionOfb = str1.IndexOf("b");

2.格式化字符串:String.Format();

1
2
string str3 = String.Format("(C) Currency:{0:C}\n",-123.45678f);
string str4 = String.Format("(d) Short Date:{0:d}\n", DateTime.Now);

2 Comments

  1. admin says:

    测试了一下,发现wp-syntax复制完代码后,会显示成

    1
    2
    
    string str3 = String.Format("(C) Currency:{0:C}\n",-123.45678f);
    string str4 = String.Format("(d) Short Date:{0:d}\n", DateTime.Now);
    

    这样的。

    而用Syntax Highlighter and Code Prettifier Plugin for WordPress会显示成

    view source
    print?
    1	string str1 = "abcd";
    2	int positionOfb = str1.IndexOf("b");

    显然多了点东西。但其又提供了复制按钮,复制完了虽然也很干净,但却是linux格式的,晕倒……

    [Reply]

  2. admin says:

    有时间要研究下咯。

    [Reply]

Leave a Reply

验证码   click to change