Created
December 6, 2020 20:58
-
-
Save Marcelektro/270587e2a887d4ac70f505c1f67f2565 to your computer and use it in GitHub Desktop.
spaceTrimmer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package net.marcelektro; | |
public class Main { | |
public static void main(String[] args) { | |
String pog = "HELLO THERE ARE WAYYYYY TOOO MANY SPACES RIP OOF SAD"; | |
System.out.println(trimSpaces(pog)); | |
} | |
public static String trimSpaces(String textToTrim) { | |
return textToTrim.trim().replaceAll(" +", " "); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment