Join Two Arrays in ColdFusion

前端 未结 9 845
青春惊慌失措
青春惊慌失措 2020-12-29 19:22

Is there a built-in way to join two arrays in ColdFusion, similar to JavaScript\'s array.concat()?

9条回答
  •  梦毁少年i
    2020-12-29 20:01

    In javascript array.join(s) creates a string out of all of the elements of the array separated by the delimiter s. A similar function to this in ColdFusion is the ArrayToList function. As far as appending an array to another I don't believe there is a CF function for that. Check http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=functions-pt0_03.html#3473387 to see the list of Array functions in CF. Or try something like this:

    
       for(index = 1; index LTE ArrayLen(array2); i = i + 1) {
          ArrayAppend(array1, array2[i]);
      }
    
    

提交回复
热议问题