File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
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
jQuery in Action, 3rd edition