REBOL 3 Docs Guide Concepts Functions Datatypes Errors
  TOC < Back Next >   Updated: 4-Aug-2010 Edit History  

REBOL 3 Functions: join

join  value  rest

Concatenates values.

Arguments:

value - Base value

rest - Value or block of values

See also:

ajoin   rejoin   form   reform   append   repend   mold   remold  

Description

Returns a new series that joins together a value with another value or block of values.

join "super" "duper"
"superduper"
join %file ".txt"
%file.txt

This differs from append and repend because a new value is created, and the first argument is not modified in any way.

The first argument determines the datatype of the returned value. When the first argument is a type of series, the return value will be that type of series (d:string, file!, url!, block!, etc.)

When the first argument is a scalar value (such as integer!, date!, time!, and others), the return will always be a string!.

When the second argument is a block!, it will be evaluated and all of its values joined to the return value.

join http:// ["www.rebol.com/" %index.html]
http://www.rebol.com/index.html
join "t" ["e" "s" "t"]
"test"
join 11:11 "PM"
"11:11PM"

Note that it also works for block! series, but returns a block, not a string:

join [1] ["two" 3 "four"]
[1 "two" 3 "four"]

And, this case is important to note:

join <a> "test"
<atest>

(See rejoin for more detail on this case.)

If you want the result here to be a string!, use the ajoin function instead.


  TOC < Back Next > REBOL.com - WIP Wiki Feedback Admin