Zak Kampmann

Greenhorn
+ Follow
since Nov 25, 2014
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Zak Kampmann

Brandi Love wrote:Hi all!

I have a string from which I need to remove all of the newlines, tabs, and spaces. Here is the code I wrote:

It removes the spaces just fine but not the newlines or tabs. How can I do this?

Thanks for the help!



The main reason it isn't working is because String.replaceAll(String, String) uses a regex for the first string and not just a pattern. If you change your code to the following:



You should see your expected results.

9 years ago