Results 1 to 1 of 1
- 10-04-2007, 09:32 PM #1
How to split a String using split function
This tip will show the use of split function to split a String according to particular separator character.
In this program Split() function is splitting the String according to ‘:’ .
Java Code:public class StringSplit { public void doit() { String str = "CompChamps:Guys:are:There"; String [] temp = null; temp = str.split(":"); dump(temp); } public void dump(String []s) { for (int i = 0 ; i < s.length ; i++) { System.out.println(s[i]); } } } public static void main(String args[]) throws Exception{ StringSplit ss = new StringSplit(); ss.doit(); }
Similar Threads
-
How to split a String using split function
By Java Tip in forum java.langReplies: 4Last Post: 04-17-2009, 08:27 PM -
problem with split method
By abhiN in forum New To JavaReplies: 7Last Post: 02-10-2009, 01:54 PM -
how to split a file
By nagaraaju in forum New To JavaReplies: 0Last Post: 03-14-2008, 08:45 AM -
How to split a string into multiple lines of x characters each
By JackJ in forum New To JavaReplies: 3Last Post: 12-17-2007, 02:35 AM -
PDF Split and Merge 0.7 beta 1
By JavaBean in forum Java SoftwareReplies: 0Last Post: 06-24-2007, 08:46 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks