This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes replacing blank space Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "replacing blank space" Watch "replacing blank space" New topic

replacing blank space

kevin schmidt
Ranch Hand

Joined: Aug 24, 2001
Posts: 85
I have a program that raeds in words, either one or two words. Now, If the program reads in two words, there is a space separating the words. How do I replace the space with and underscore?
before - Meeting Organizer
after - Meeting_Organizer
Paul Stevens
Ranch Hand

Joined: May 17, 2001
Posts: 2823
after = before.replace(' ', '_');
I agree. Here's the link:
subject: replacing blank space
Similar Threads
PriorityQueue Question
Looks smaller in Unix ?
String Tokenizer
Printing arrays of ints