public Method

Array.join(...)

array.join(sep=$,)     str

Returns a string created by converting each element of the array to a string, separated by sep.

[ "a", "b", "c" ].join        #=> "abc"
[ "a", "b", "c" ].join("-")   #=> "a-b-c"

Source Code

/*
*  call-seq:
*     array.join(sep=$,)    -> str
*  
*  Returns a string created by converting each element of the array to
*  a string, separated by <i>sep</i>.
*     
*     [ "a", "b", "c" ].join        #=> "abc"
*     [ "a", "b", "c" ].join("-")   #=> "a-b-c"
*/

static VALUE
rb_ary_join_m(argc, argv, ary)
   int argc;
   VALUE *argv;
   VALUE ary;
{
   VALUE sep;

   rb_scan_args(argc, argv, "01", &sep);
   if (NIL_P(sep)) sep = rb_output_fs;

   return rb_ary_join(ary, sep);
}
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.