cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

convert StringBuffer to String[]

Former Member
0 Likes
1,950

how to convert StringBuffer to String Array ?


StringBuffer strContent=new StringBuffer();
for(int i=0;i<3;i++){
strContent.append("This is new message:" +i);
}

//how to add to this
String[] strArrContent = {};

View Entire Topic
prashil
Product and Topic Expert
Product and Topic Expert
0 Likes

Hi Yzme,

Put a seperater in between the strings like &,

<i>strConent.append("This is a new message"i"&");</i>

Now you can split the stringbuffer into an array;

<i>strArrContent[] = strContent.split("&");</i>

This will split the stringbuffer into elements of Array with a seperator as "&";

Regards,

Prashil