Created
September 4, 2017 10:22
-
-
Save mehtaparitosh/a3bffffd44858465f671c30f140cae06 to your computer and use it in GitHub Desktop.
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 Programs; | |
import java.util.*; | |
/** | |
* | |
* @author paritosh mehta | |
*/ | |
public class WhiteSpace { | |
public static void main(String args[]){ | |
Scanner sc = new Scanner(System.in); | |
System.out.println("Enter the String: "); | |
String stringWS = new String(); | |
stringWS = sc.nextLine(); | |
stringWS.trim(); | |
stringWS = stringWS.replaceAll("\\s+"," "); | |
System.out.println(stringWS); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment