<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Question Re: convert StringBuffer to String[] in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/convert-stringbuffer-to-string/qaa-p/2119125#M923791</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Yzme,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  we can differentiate between String and String buffer like , A string buffer is similar to String, but the contents can be modified at any point of time using some methods.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To convert a String buffer into a String we have toString() method.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for example : &lt;/P&gt;&lt;P&gt;x = "a" + 4 + "c"&lt;/P&gt;&lt;P&gt;is similar to &lt;/P&gt;&lt;P&gt; x = new StringBuffer().append("a").append(4).append("c")&lt;/P&gt;&lt;P&gt;                           .toString()&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;where x is a string..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;reference :  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;a href="http://java.sun.com/j2se/1.4.2/docs/api/"&amp;gt;http://java.sun.com/j2se/1.4.2/docs/api/&amp;lt;/a&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do reward points..if this helps u in reaching at ur solution;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//&lt;/P&gt;&lt;P&gt;how to convert StringBuffer to String Array ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;StringBuffer strContent=new StringBuffer();&lt;/P&gt;&lt;P&gt;for(int i=0;i&amp;lt;3;i++){&lt;/P&gt;&lt;P&gt;strContent.append("This is new message:" +i);&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;//how to add to this&lt;/P&gt;&lt;P&gt;String[] strArrContent = {};&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 10 Apr 2007 09:28:06 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-04-10T09:28:06Z</dc:date>
    <item>
      <title>convert StringBuffer to String[]</title>
      <link>https://community.sap.com/t5/technology-q-a/convert-stringbuffer-to-string/qaq-p/2119121</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;how to convert StringBuffer to String Array ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
StringBuffer strContent=new StringBuffer();
for(int i=0;i&amp;lt;3;i++){
strContent.append("This is new message:" +i);
}

//how to add to this
String[] strArrContent = {};

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Apr 2007 03:46:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/convert-stringbuffer-to-string/qaq-p/2119121</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-06T03:46:27Z</dc:date>
    </item>
    <item>
      <title>Re: convert StringBuffer to String[]</title>
      <link>https://community.sap.com/t5/technology-q-a/convert-stringbuffer-to-string/qaa-p/2119122#M923788</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Yzme,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Put a seperater in between the strings like &amp;amp;,&lt;/P&gt;&lt;P&gt;&amp;lt;i&amp;gt;strConent.append("This is a new message"&lt;EM&gt;i&lt;/EM&gt;"&amp;amp;");&amp;lt;/i&amp;gt;&lt;/P&gt;&lt;P&gt;Now you can split the stringbuffer into an array;&lt;/P&gt;&lt;P&gt;&amp;lt;i&amp;gt;strArrContent[] = strContent.split("&amp;amp;");&amp;lt;/i&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will split the stringbuffer into elements of Array with a seperator as "&amp;amp;";&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Prashil&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Apr 2007 05:57:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/convert-stringbuffer-to-string/qaa-p/2119122#M923788</guid>
      <dc:creator>prashil</dc:creator>
      <dc:date>2007-04-06T05:57:52Z</dc:date>
    </item>
    <item>
      <title>Re: convert StringBuffer to String[]</title>
      <link>https://community.sap.com/t5/technology-q-a/convert-stringbuffer-to-string/qaa-p/2119123#M923789</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;String[] strArrContent = new String[]{strContent.toString()};&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Apr 2007 14:14:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/convert-stringbuffer-to-string/qaa-p/2119123#M923789</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-06T14:14:42Z</dc:date>
    </item>
    <item>
      <title>Re: convert StringBuffer to String[]</title>
      <link>https://community.sap.com/t5/technology-q-a/convert-stringbuffer-to-string/qaa-p/2119124#M923790</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Denis,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think this will result, in a single element array.&lt;/P&gt;&lt;P&gt;If we output strArrContent.length it will give only 1. Is that correct?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What i understood by the requirement is that Yzme wants different messages&lt;/P&gt;&lt;P&gt;in different element of the array like &lt;/P&gt;&lt;P&gt;strArrContent[0] = "This is new message0";&lt;/P&gt;&lt;P&gt;strArrContent[1] = "This is new message1";&lt;/P&gt;&lt;P&gt;strArrContent[2] = "This is new message2";&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yzme, please verify your requirement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Prashil&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Apr 2007 15:30:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/convert-stringbuffer-to-string/qaa-p/2119124#M923790</guid>
      <dc:creator>prashil</dc:creator>
      <dc:date>2007-04-06T15:30:29Z</dc:date>
    </item>
    <item>
      <title>Re: convert StringBuffer to String[]</title>
      <link>https://community.sap.com/t5/technology-q-a/convert-stringbuffer-to-string/qaa-p/2119125#M923791</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Yzme,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  we can differentiate between String and String buffer like , A string buffer is similar to String, but the contents can be modified at any point of time using some methods.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To convert a String buffer into a String we have toString() method.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for example : &lt;/P&gt;&lt;P&gt;x = "a" + 4 + "c"&lt;/P&gt;&lt;P&gt;is similar to &lt;/P&gt;&lt;P&gt; x = new StringBuffer().append("a").append(4).append("c")&lt;/P&gt;&lt;P&gt;                           .toString()&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;where x is a string..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;reference :  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;a href="http://java.sun.com/j2se/1.4.2/docs/api/"&amp;gt;http://java.sun.com/j2se/1.4.2/docs/api/&amp;lt;/a&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do reward points..if this helps u in reaching at ur solution;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//&lt;/P&gt;&lt;P&gt;how to convert StringBuffer to String Array ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;StringBuffer strContent=new StringBuffer();&lt;/P&gt;&lt;P&gt;for(int i=0;i&amp;lt;3;i++){&lt;/P&gt;&lt;P&gt;strContent.append("This is new message:" +i);&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;//how to add to this&lt;/P&gt;&lt;P&gt;String[] strArrContent = {};&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Apr 2007 09:28:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/convert-stringbuffer-to-string/qaa-p/2119125#M923791</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-10T09:28:06Z</dc:date>
    </item>
  </channel>
</rss>

