Join member of array into string

วันจันทร์ที่ 14 กันยายน พ.ศ. 2552

Array of integration into a string. A member of array is included into a string. The separator can be set as needed.

join ( 'separator you want', array).

Eg.

@ a = ( "Hello,", "Welcome", "Perl! \ n");

$ a = join ( '', @ a);

# Is included in all array separated by '' (space 1 box), hence $ a = "Hello, Welcome Perl! \ N".

$ b = join ( 'and', @ a);

# $ B = "Hello, and Welcome and Perl! \ N".

$ c = join ('', @ a);

# $ C = "Hello, WelcomePerl! \ N".

0 ความคิดเห็น:

แสดงความคิดเห็น

 
 
 
 
Copyright © Basic Perl