SC: Array and Hashtable/Hashmap/Dictionary

Features wanted...
Filehero
Posts: 2645
Joined: 27 Feb 2012 18:50
Location: Windows 10 Pro x64

Re: SC: Array and Hashtable/Hashmap/Dictionary

Post by Filehero »

Idea for Arrays 1.0

Code: Select all

toarray()

  Returns an array for a tokenized string.

Syntax

  toarray(string, [separator="|"])

  string Tokenized source string.

  separator Separator of tokens; defaults to "|".
  If empty ("") then the string is separated by char creating a char array.

  return The array. If the string passed is empty, the array returned will have a length = 0.

Code: Select all

tostring()

  Returns a tokenized string for an array.

Syntax

  tostring(array, [separator="|"])

  array The array to be converted into a tokenized string.

  separator Separator used for tokenization; defaults to "|".
  If empty ("") then all array elements simply are concatenated.

  return The string. If the array passed has no element, the empty string "" is returned.
This way we would get to complementary adapters to the existing SC API, thus you can focus on the syntax changes.

FH

admin
Site Admin
Posts: 60617
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: SC: Array and Hashtable/Hashmap/Dictionary

Post by admin »

Yes, that would be useful.

I would probably prefix all array related functions, like this:
array_tostring()
array_fromstring()

Filehero
Posts: 2645
Joined: 27 Feb 2012 18:50
Location: Windows 10 Pro x64

Re: SC: Array and Hashtable/Hashmap/Dictionary

Post by Filehero »

admin wrote:array_tostring()
array_fromstring()
Would be ok for me.

PeterH
Posts: 2785
Joined: 21 Nov 2005 20:39
Location: Germany

Re: SC: Array and Hashtable/Hashmap/Dictionary

Post by PeterH »

Yes: this form of names seems meaningful to me, too.
Win11 Pro 223H2 Gerrman

Filehero
Posts: 2645
Joined: 27 Feb 2012 18:50
Location: Windows 10 Pro x64

Re: SC: Array and Hashtable/Hashmap/Dictionary

Post by Filehero »

:whistle:

admin
Site Admin
Posts: 60617
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: SC: Array and Hashtable/Hashmap/Dictionary

Post by admin »

:) ...................... :ninja:

Post Reply