• Post Reply Bookmark Topic Watch Topic
  • New Topic

ADDING TWO STRING  RSS feed

 
Rajesh Veluchamy
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
String a ="select distinct";
String b =", account_number";

i need string c = "select distinct account_number";

the ","(coma) should be removed from the new string c.


There should be some Java string function for this.

Thanks in advance for all
 
Jilesh Lakhani
Ranch Hand
Posts: 49
Java Python Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, you can use, String Functions like

indexOf
subString
replaceAll
 
Anand Narayan
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
[solution deleted]
[ February 27, 2008: Message edited by: fred rosenberger ]
 
fred rosenberger
lowercase baba
Bartender
Posts: 12563
49
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We try to not simply provide solutions here, but focus on helping each person figure it out for themselves. Please don't post solutions - ask leading questions, make suggestions, point out errors in code the questioner provides... things like that.
 
Campbell Ritchie
Marshal
Posts: 56525
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can also do it by putting the two Strings into StringBuilders, then deleting the comma at the beginning and appending them. You might need a toString() call before appending.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!