Split string using jsp

Below is the code which shows implementation of split function, saving the result in an array & display of the same.



String polid=session.getAttribute("policyid").toString();

E.g: polid=286,354,456


String[] myStr = polid.split(",");

for( int i=0 ; i < myStr.length ; i++){

System.out.println(myStr[i]);

}//for

No comments:

Post a Comment