UIZE JavaScript Framework

MODULES Uize.Array.Join

1. Introduction

The Uize.Array.Join module provides methods for joining arrays to form strings.

DEVELOPERS: Chris van Rensburg

1.1. Examples

There are no dedicated showcase example pages for the Uize.Array.Join module.

SEARCH FOR EXAMPLES

Use the link below to search for example pages on the UIZE Web site that reference the Uize.Array.Join module...

SEARCH

1.2. Implementation Info

The Uize.Array.Join module defines the Uize.Array.Join package under the Uize.Array namespace.

1.2.1. Features Introduced in This Module

The features listed in this section have been introduced in this module.

STATIC METHODS

Uize.Array.Join.hugJoin

STATIC PROPERTIES

Uize.Array.Join.moduleName | Uize.Array.Join.pathToResources

1.2.2. Features Overridden in This Module

No features have been overridden in this module.

1.2.3. Features Inherited From Other Modules

This module has no inherited features.

1.2.4. Modules Directly Under This Namespace

There are no modules directly under this namespace.

1.2.5. Unit Tests

The Uize.Array.Join module is unit tested by the Uize.Test.Uize.Array.Join test module.

2. Static Methods

2.1. Uize.Array.Join.hugJoin

Returns a string, that is the concatenation of the specified array of items, where a prefix and suffix can be specified for hugging each item in the array, and where an optional separator can additionally be specified.

SYNTAX

joinedSTR = Uize.Array.Join.hugJoin (itemsARRAY,itemPrefixSTR,itemSuffixSTR);

EXAMPLE 1

var actions = ['view','reset','save','open','close'];
alert (Uize.Array.Join.hugJoin (actions,'[ ',' ]'));

EXAMPLE 1 - OUTPUT

[ view ][ reset ][ save ][ open ][ close ]

VARIATION

joinedSTR = Uize.Array.Join.hugJoin (itemsARRAY,itemPrefixSTR,itemSuffixSTR,separatorSTR);

When the optional separatorSTR parameter is specified, then the items being joined will be separated by the specified separator string. This provides you with the functionality you would normally get from the built-in join instance method of the Array object.

Technically, the statement Uize.Array.Join.hugJoin (array,'','',separator) would be equivalent to the statement array.join (separator). But, if you just wanted to join an array with a separator string, then you would just use the join method, so the separatorSTR parameter is the last parameter and is optional for the Uize.Array.Join.hugJoin method, since the assumption is that you're likely using this method for its prefix/suffix feature.

EXAMPLE 2

var actions = ['view','reset','save','open','close'];
alert (Uize.Array.Join.hugJoin (actions,'[ ',' ]',' - '));

EXAMPLE 2 - OUTPUT

[ view ] - [ reset ] - [ save ] - [ open ] - [ close ]

EXAMPLE 3

var actions = ['view','reset','save','open','close'];
alert (Uize.Array.Join.hugJoin (actions,'\t','\n')); // on separate lines, indented

EXAMPLE 3 - OUTPUT

  view
  reset
  save
  open
  close

EXAMPLE 4

var actions = ['view','reset','save','open','close'];
alert (Uize.Array.Join.hugJoin (actions,'action: "','"\n','---------------\n'));

EXAMPLE 4 - OUTPUT

action: "view"
---------------
action: "reset"
---------------
action: "save"
---------------
action: "open"
---------------
action: "close"

IMPLEMENTATION INFO

this feature was introduced in this module

3. Static Properties

3.1. Uize.Array.Join.moduleName

IMPLEMENTATION INFO

this feature was introduced in this module

3.2. Uize.Array.Join.pathToResources

IMPLEMENTATION INFO

this feature was introduced in this module