wulak walik kata atau kalimat

Membuat aplikasi sederhana untuk wulak walik kata seperti bahasa Arek Malang :p
# arema mode on

# method untuk membalik kata
public String wolak(String text){
        char [] c = text.toCharArray();
        StringBuffer sb = new StringBuffer();
        for (int i = c.length - 1 ; i >=0 ; i--){
            sb.append(c[i]);
        }
        return sb.toString();
    }

# method untuk membaca spasi / mesisahkan kata berdasarkan spasi

public String bacaSpaci(String text){
        String [] arrStr = text.split(" ");
        StringBuffer sb = new StringBuffer();
        for (String s : arrStr){
            s = wolak(s);
            sb.append(s+" ");
        }
        return sb.toString();
    }

Tinggal buat dech tampilan GUI nya di netbeans.

# Tampilan Hasil

Thank to
Netbeans 7.0.1
Opensuse 11.2
KSnapshot

Published by

saifiahmada

Begin a big Process with a bit trying

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