package blog.emrahkahraman.com.tr;
import java.util.StringTokenizer;
public class StringBolme {
public static void main(String[] args) {
String text="Emrah Kahraman Hero";
String tarih="08/05/2011";
String noktalisayi="1.051";
String virgullusayi="1,1";
//stringi bosluklara gore bolme
StringTokenizer st=new StringTokenizer(text);
while(st.hasMoreTokens())
{
System.out.println(st.nextToken());
}
//stringi / simgesine gore bolme
StringTokenizer st2=new StringTokenizer(tarih,"/");
while(st2.hasMoreTokens())
{
System.out.println(st2.nextToken());
}
//stringi . ‘ e gore bolme
StringTokenizer st3=new StringTokenizer(noktalisayi,".");
while(st3.hasMoreTokens())
{
System.out.println(st3.nextToken());
}
//stringi , ‘ e gore bolme
StringTokenizer st4=new StringTokenizer(virgullusayi,",");
while(st4.hasMoreTokens())
{
System.out.println(st4.nextToken());
}
}
}
Ekran Çıktısı
Emrah
Kahraman
Hero
08
05
2011
1
051
1
1
Aylin Muzeffer
15/05/2011 — 14:38
peki bu bolunmus stringleri nasil birlesdire biliriz, mesela emrah08, ve ya kahraman051? simdiden tessekurler
Emrah Kahraman
19/05/2011 — 13:07
http://blog.emrahkahraman.com.tr/java-string-bolme-stringbuffer-kullanimi/