Split word in string

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

Split words (Split String) is divided by a string of variables required to store the Pattern string to break into the A-ray.

split (/ character to break a word /, variables like divided, the number you want).

Eg.

$ a = "Hello, Welcome Perl \ n";

@ a = split (/ /, $ a);

# Find a divide words when spaces 1 box (/ /) Therefore, @ a = ( "Hello,", "Welcome", "Perl \ n").

@ a = split (/ /, $ a, 2);

# Find a divide words when spaces 1 box (/ /) The amount to only 2 Therefore, the @ a = ( "Hello,", "Welcome").

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

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

 
 
 
 
Copyright © Basic Perl