Memotong Kata

Berikut adalah program untuk memotong kalimat menggunakan method Split. 

01 /**
02  *
03  * @author Hamasah!
04  */
05 public class Split {
06  
07   public static void main(String args[]) {
08   String tiket="1|ga|8:55|10:00|gate 6|delay";
09   String [] potong;
10   
11   System.out.println("Kalimat dalam tiket : "+tiket);
12   potong=tiket.split("\\|");
13
14    for (int i = 0; i <potong.length; i++) {
15       System.out.println("kata ke-"+i+": "+potong[i]);
16    }
17   }
18

About Sheilla Rizkia Ferianty

Semangat!

Posted on 03/12/2011, in Java and tagged , , . Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: