Apply the block parameter to each element in the array and return a new array. Collect is a method which is very functional programming-like in nature. Think of it working a bit like foreach in C# or VB.
["a","aa","aaa"].Collect{each | each.Length}
123
"SortBy"
Sort "one", "two", "three", "four", "five" according to the length of each string:
Q How do I sort an array descending instead of ascending?
A For numbers and topics with numeric properties, subtract the value of the sort key from 0. For example: "[ 1, 3, 6 ].SortBy { x | 0.Subtract( x ) }" -- ScottAinsworth [2006-02-26]
Discussion
Why was Collect named as it was. Why not ForEach? I'm trying my best to understand it and how it is best used. -- MikeSchinkel [7/5/2004]
[1,2,3].ToOneString seems to be something that one would use frequently. How about some syntactic sugar? -- MikeSchinkel [7/5/2004]
Does anyone ever read and/or answer these questions? -- MikeSchinkel [2004-07-19]
How can I do the equivalent of a "SELECT DISTINCT" in SQL? Maybe adding a Distinct() function similar in syntax to Collect() and Sort()? -- MikeSchinkel [2004-07-19]
There is a Unique method that returns unique values -- RoystonShufflebotham [2005-07-07]
Is there a way to parse a coma separated string, as a page propertie ? -- ArnoTournier [2004-09-30]
You can use the GetListProperty() method of TopicInfoType to do just this. -- JimmySieben [2005-08-27]
How to get a normal array out of a nested one (e.g. all list property values of all topics)? I need something like this:
FlexWiki.ArrayDemo(1:21) : No such property or function: Array.Union
Why use ToOneString if ToString does the same, and I can use it generally (that is, I can use GetProperty(x.ToString) and pass both Array or String as x? -- HerbyVojčík [2006-04-27]
Discription of a stable sort.
3/1/2006 6:50:39 PM - -68.15.147.130
Discription of a stable sort.
3/1/2006 6:50:39 PM - -68.15.147.130
Click to read this topic
1/24/2008 8:57:35 AM - FLWCOM-jwdavidson
Founder and President of Guides, Inc.
1/24/2008 6:29:25 AM - FLWCOM-jwdavidson
Founder and President of Guides, Inc.
1/24/2008 6:29:25 AM - FLWCOM-jwdavidson
Founder and President of Guides, Inc.
1/24/2008 6:29:25 AM - FLWCOM-jwdavidson
List of annoying things about Wikis
2/11/2008 12:19:30 PM - -66.46.216.196
Tim is a Solutions Architect with Informatica
1/24/2008 7:50:24 AM - FLWCOM-jwdavidson
Founder and President of Guides, Inc.
1/24/2008 6:29:25 AM - FLWCOM-jwdavidson
This is my home here, at FlexWiki...
9/30/2004 9:30:37 AM - ltearno@free.fr-82.230.35.136
A TopicInfo object can be used to discover things about a topic
6/16/2005 8:00:10 AM - -193.129.160.10
FlexWiki user with experience setting up FlexWiki for project usage on an intranet.
7/19/2006 9:46:41 AM - -140.32.73.93
James is a Business Solutions Architect in a Manufacturing Intelligence firm in Adelaide, South Australia.