zoukankan      html  css  js  c++  java
  • C# id 字符串之类的拼接

    背景 : id数组  [1,2,3,4,45,7] 要拼接字符串‘1’,‘2’,‘3’,看了同事自己写了代码 string+=‘,’ 之类的  头大

    解决:string有静态函数 ,string.Join(",'",array)可以满足要求 首尾缺少的 符号 可以最后string.fromat(''{0}'',xxx)解决,

          总比写成  

    if(xxx!=null)
    {
        xxx+=",'"+array[i]+"'"; 
    }

    好看吧。

    而且 为了 方便 还可以写成静态扩展 . 

  • 相关阅读:

    链表
    Codeforces 1290A/1291C
    Codeforces 1291B
    Codeforces 1291A
    Codeforces 1295C
    Codeforces 1295B
    ZJNU 2356
    ZJNU 2354
    ZJNU 2353
  • 原文地址:https://www.cnblogs.com/Zoes/p/4975948.html
Copyright © 2011-2022 走看看