3:53 pm - Monday March 24, 2453

String Example Program for split(string regex)

CANDID INDUSTRIAL TRAINING -- CHENNAI
Corporate Training for Experienced Candidate
Struts | Hibernate | Spring | Java / J2EE
SOAP | RestFull | Design Pattern | more...
Ph: +91 72000 69003
137b, 2nd st, shanthi nagar, Chrompet, Chennai -600044

*This program the array of strings computed by splitting this string around matches of the given regular expression.
* @author   candidjava.com
* @description: It returns the array of strings computed by splitting this string around matches of the given regular expression.
*/

public class Split2
{
public static void main(String args[])
{
String str = "st1-st2-st3";
String split = "-";
String[] temp;
temp = str.split(split);
for(int i =0; i < temp.length ; i++)
System.out.println(temp[i]);
}
}


Output:
st1
st2
st3

Filed in: Z-A All Java Codes

Comments are closed.