Author Topic: New function in 9.5 (ArrayToString)  (Read 16394 times)

Mathias (Author)

  • Administrator
  • VIP Member
  • *****
  • Posts: 4416
    • View Profile
    • Multi Commander
New function in 9.5 (ArrayToString)
« on: January 04, 2020, 14:34:37 »
From version 9.5 ArrayToString(..) now exists
http://multicommander.com/docs/multiscript/functions/array#arraytostring

It let you have an array of strings and create one string out of them, and you can specify what delimiter you want to use. (text bit that should be in between the strings)
and also if you want to put " around the each string.

All this can already be done with MultiScript funtions, but this function will make it much easier.
The main reason for this is to make string that are sent to external program as parameters easier.
like if you want to create a string with all the selected files and want to use them as a parameter

example
Code: [Select]
// get FULL path for all selected items from active view
@var $selectedItems = GetSelectedPaths();

// delimiter here is a comma and then space. ", "
// 1 is that all string should have " around then. so if there are space in the string the program can open them correct anyway
@var $selected = ArrayToString( $selectedItems , ", ", 1 );

MC.Run CMD="C:\Apps\NotePad++\notepad++.exe" ARG="{$selected}"
« Last Edit: January 04, 2020, 14:40:43 by Mathias (Author) »