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++:

int eg.size = 3
string eg[0] = "cat",
       eg[1] = "dog",
       eg[2] = "%"

console("{", join(eg, "; "), "}")

n++ example

Example of join being used with n++:

@int eg.size = 3
@string eg[0] = "cat",
        eg[1] = "dog",
        eg[2] = "%"

@console("{", join(eg, "; "), "}")