Source language: Translate to:

More array functions

Post your suggestions for future versions of NeoBook

Moderator: Neosoft Support

More array functions

Postby Tony Kroos » Fri Aug 22, 2014 1:13 am

It would be nice to have more array functions, such as Insert, Delete items, Clone (duplicate) array, Set upper|lower bounds, ReDim, etc... It would be looking like this:

ArrayInsert "[ArrVariable]" "[Index]" "[Data]" - insert item and shift array indexes
ArrayDelete "[ArrVariable]" "[Index]" - delete item and shift array indexes
ArrayErase "[ArrVariable]" - deletearray
ArrayCopy "[ArrVariable]" "[NewArrVariable]" - copy array into new array
ArrayGet "[ArrVariable]" "[UppBound]" "[LowBound]" "[ArrCount]" - getarrayinfo
ArraySet "[ArrVariable]" "[UppBound]" "[LowBound]" "[ArrCount]" - some kind of redim with preserving data
ArraySort "[ArrVariable]" "ASCEND / DESCEND" - sort array (as string data)
ArrayFind "[ArrVariable]" "[DataToSearch]" "[ItemIndex]" - returns item index (0 if no hits) or array of indexes (if multiple hits)

and (imho) it looks more "professional" and comfortable than manipulating with hidden listbox and additional plugins, isn't it?
Tony Kroos
Posts: 405
Joined: Thu Oct 15, 2009 3:43 pm

Re: More array functions

Postby Gaev » Fri Aug 22, 2014 10:09 am

Tony Kroos:

1) Not sure if HPW, dec or David de Argentina already have such functionality within one their plugins.

2) Javascript has a rich set of "array processing methods" ... so one could build a NeoBook Function Library whose functions (written in Javascript) can be Call'ed from any of your publications.

However, since I don't see a method of passing NeoBook Array Variable to such Functions, one would have to do an "Array to Delimiter Separated String" conversion ... and pass the String to the (javascript) Functions.

This can be done with native NeoBook Actions inside a Loop/EndLoop block ... but might take long for huge arrays.

Would be nice to have a native NeoBook command for this ... like ...
Code: Select all
ArrayToString "array name" "start index" "end index" "item delimiter" "string variable"

ArrayToString "[country]" "1" "999999" "!@#$%^" "[countryList]"

... a kind of reverse of StrParse ... could have an "option" parameter to indicate whether "empty/missing array items should be ignored or not"
User avatar
Posts: 3757
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Re: More array functions

Postby Neosoft Support » Fri Aug 22, 2014 12:09 pm

Good suggestions. I will print and add to the list.
NeoSoft Support
Neosoft Support
NeoSoft Team
Posts: 5621
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Re: More array functions

Postby dec » Fri Aug 22, 2014 2:00 pm


Gaev wrote:1) Not sure if HPW, dec or David de Argentina already have such functionality within one their plugins.

My npUtil plugin is the "swiss knife" of my plugins, and, can be a good place to count with some Array related actions, in the same way than other categories like "Strings utils", "File utils", etc., etc. However, the NeoBook SDK do not provide too much stuff in order to deal with Arrays, as I can remember right now. Anyway I will to investigate this in the near future.

On the other hand maybe an interesting option is to use my npStrs plugin, which allow you to work with objects which contains "list of strings" (similar to Arrays) in various ways, allowing add, append, insert, delete, copy, find, locate, sort, avoid duplicates, deal with keys/values, load/save to/from file, etc., etc., etc.. ;)

Tony Kroos wrote:ArrayErase "[ArrVariable]" - deletearray

You can use the "DeleteArray" action to do this. ;)
Last edited by dec on Fri Aug 22, 2014 2:09 pm, edited 4 times in total.
Enhance your NeoBook applications!
58 plugins, 1131 actions and 233 samples
NeoPlugins website:
User avatar
Posts: 1663
Joined: Wed Nov 16, 2005 12:48 am
Location: Spain

Return to NeoBook Suggestions

Who is online

Users browsing this forum: No registered users and 1 guest