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

convert StringBuffer to String[]

Former Member
0 Likes
1,949

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
Former Member
0 Likes

String[] strArrContent = new String[]{strContent.toString()};

prashil
Product and Topic Expert
Product and Topic Expert
0 Likes

Hi Denis,

I think this will result, in a single element array.

If we output strArrContent.length it will give only 1. Is that correct?

What i understood by the requirement is that Yzme wants different messages

in different element of the array like

strArrContent[0] = "This is new message0";

strArrContent[1] = "This is new message1";

strArrContent[2] = "This is new message2";

Yzme, please verify your requirement.

Thanks,

Prashil