Page 1 of 1

Expansion of explode() and implode()

Posted: 29 May 2025 15:22
by PeterH
Hey - I'm just missing something...
With explode() we can fill a list into an indexed array.
I'd need the ability to fill a list with elements like 'name1=value1' into an associative array.
E.g.: the output of SetLayout(, ';')
Result would be like
Explode($Apane[], SetLayout(, ';'), ';', 'a'); // 'a' = create assoc array

This would enable us to change a kind of 'Control-List' to a 'Control-Array = Control-Structure' by just 1 command, where after that all values could directly be accessed by e.g.
$p1w = $Apane['Pane1Width'];

The same, please, for the opposite direction, for implode().

Would allow for (just one shortened example, hopefully w/o :bug: ):

Code: Select all

  Explode($Apane[], SetLayout(, ';'), ';', 'a'); // list2array
  $p1w = $Apane['Pane1Width'];                   // temp store
  $Apane['Pane1Width'] = $Apane['Pane2Width'];   // exchg
  $Apane['Pane2Width'] = $p1w;                   // exchg other
  SetLayout(Implode($Apane, , ';', 'a'), ';');   // fine that implode can *return* it's result :-)
  SetLayout($panelist, ';');                     // set result 
I think this shows enough advantages of this enhancement?

(Sorry for the mess of separators - but explode and setlayout use different dflts :whistle: )

Re: Expansion of explode() and implode()

Posted: 29 May 2025 16:44
by admin
I'll look into it after 64-bit.

Re: Expansion of explode() and implode()

Posted: 29 May 2025 21:42
by PeterH
I couldn't expect more!

So thanks,
and much luck with TB and 64bit!

Re: Expansion of explode() and implode()

Posted: 16 Jun 2025 11:18
by Raf
+1
I would like to use this feature to display the contents of the dictionary to the user. It is unwise to duplicate the contents of the dictionary in a separate text message.