• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Is it possible to remove all spaces from a String?(SOLVED)

 
Matt Kohanek
Village Idiot
Ranch Hand
Posts: 484
Java jQuery Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No matter how many there are.

One Space should become OneSpace
Two More Spaces should become TwoMoreSpaces
etc


solution




-thanks henry
 
Henry Wong
author
Marshal
Pie
Posts: 21220
81
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sure... Take a look at the java.lang.String replace(), or replaceAll() methods.

Henry
 
Henry Wong
author
Marshal
Pie
Posts: 21220
81
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Matt Kohanek wrote:
solution




Interesting solution. How about something much simpler? Like....



Henry
 
Matt Kohanek
Village Idiot
Ranch Hand
Posts: 484
Java jQuery Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
lol, well it just wouldnt feel like my code unless it was overly complicated and inefficient!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic