andrewplummer/Sugar — pull request #303 by kevincox (2013-04-04 04:28:02+00:00)
Title: Added powerful Array functions.

I felt the array functions could use a bit more. The commit messages are below.

Added Array.replace().

Array.replace is a convenience function around Array.removeAt() and Array.add(). There is also Array.replaced() that returns a new Array where the values have been replaced.

Array.replace() can also be called with no elements for a pythonic feel.

Added Array.cut().

Array.cut is a complex method for creating a new string from pieces of an old string. It supports beginning, end, step and count parameters allowing precise control of the result. For convenience it wraps indecies by default but that can be disabled for more complex queries. Reverse iteration is supported and many optimization shortcuts are taken, including falling back to a single slice() call on simple queries.