fn: join
[contents]

Contents

Syntax

The syntax for join calls is:

f++:  
join{options}(object, string)
join{options}(object, string, begin)
join{options}(object, string, begin, end)

n++:  
@join{options}(object, string)
@join{options}(object, string, begin)
@join{options}(object, string, begin, end)

Description

The join function takes all items in an iterable object and returns them joined in to one string, it takes 2-4 input parameters, the first parameter should be an iterable object, the second parameter should be a string to separate each item with, the optional third parameter should be a non-negative integer to specify which position to begin at and the optional fourth parameter should be a non-negative integer to specify which position to end at.

Options

The following options are available for join calls:

option description
<- add separator at beginning
-> add separator at end
<-> add separator at both beginning and end
option description

f++ example

Examples of join being used with f++:

  1. int eg.size = 3
  2. string eg[0] = "cat",
  3. eg[1] = "dog",
  4. eg[2] = "%"
  5.  
  6. console("{", join(eg, "; "), "}")

n++ example

Example of join being used with n++:

  1. @int eg.size = 3
  2. @string eg[0] = "cat",
  3. eg[1] = "dog",
  4. eg[2] = "%"
  5.  
  6. @console("{", join(eg, "; "), "}")