How to concatenate array of integers into comma separated string

前端 未结 4 1045
陌清茗
陌清茗 2021-01-22 01:55

I have two question, acually:

  1. How to join array of integers into comma separated string? (1,2,3) => \"1,2,3\"
  2. How to convert array of integers t
4条回答
  •  难免孤独
    2021-01-22 02:39

    I don't if this is correct. Usually, they have powershell2. Just give this a little try.

    $a = @()
    $strArrayNum=""
    for($i=0; $i -lt $arraylist.length; $i++ ){
      $strArrayNum += $element
      $strArrayNum = $i+1 -eq $arraylist.length ? "" : ","
    }
    
    $a = $strArrayNum.Split(",")
    

提交回复
热议问题