Results 1 to 5 of 5
Thread: String concatenation problem
- 11-25-2011, 08:07 PM #1
Member
- Join Date
- Nov 2011
- Posts
- 3
- Rep Power
- 0
String concatenation problem
if(expandedTag[baseIndex - 1] == 0)
{
baseArray[baseIndex] = new String(bufferString.append(temp2).append("SHOULD_B E_COLLAPSED").toString());
}
else if(expandedTag[baseIndex - 1] == 1 || expandedTag[baseIndex - 1] == -1)
{
baseArray[baseIndex] = bufferString.append(temp2).toString();
}
I don't see what could be wrong with the top string, but it destroys the app. The bottom works fine. What am I doing wrong?
- 11-25-2011, 08:19 PM #2
Re: String concatenation problem
it destroys the app.
- 11-26-2011, 12:33 AM #3
Member
- Join Date
- Nov 2011
- Posts
- 3
- Rep Power
- 0
Re: String concatenation problem
Source code can be found here: Android Tree Bulletin
- 11-27-2011, 07:50 AM #4
Re: String concatenation problem
Moved from 'New to Java'
dbIf you're forever cleaning cobwebs, it's time to get rid of the spiders.
- 11-28-2011, 02:51 PM #5
Member
- Join Date
- Nov 2011
- Posts
- 3
- Rep Power
- 0
Re: String concatenation problem
//I have found a solution to this particular problem
String collapsedString = "SHOULD_BE_COLLAPSED";
char[] chars = new char[10000];
for(int x = 0; x < bufferString.length(); x++)
{
chars[x] = bufferString.charAt(x);
}
for(int x = bufferString.length(); x < temp2.length() + bufferString.length(); x++)
{
chars[x] = temp2.charAt(x - bufferString.length());
}
for(int x = temp2.length() + bufferString.length(); x < collapsedString.length() + temp2.length() + bufferString.length(); x++)
{
chars[x] = collapsedString.charAt(x - bufferString.length() - temp2.length());
}
baseArray[baseIndex] = String.copyValueOf(chars).trim();
Similar Threads
-
String concatenation vs. StringBuilder.
By stchman in forum New To JavaReplies: 5Last Post: 08-23-2011, 11:17 AM -
Concatenation with strings
By link6790 in forum New To JavaReplies: 16Last Post: 05-05-2011, 07:33 PM -
Accessing array index through the result of a string concatenation
By colpwd in forum New To JavaReplies: 4Last Post: 08-19-2010, 01:06 AM -
Database Column vs String Concatenation
By varun_33 in forum JDBCReplies: 1Last Post: 12-11-2007, 04:14 PM
Bookmarks