Created
May 2, 2015 15:57
-
-
Save agusmakmun/abe698e966c5b4aba3d2 to your computer and use it in GitHub Desktop.
Count Character Without Space is Java
This file contains hidden or 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
/* | |
@author Summon Agus | |
@blog bloggersmart.net | |
*/ | |
public class WithOutSpace { | |
public static void main(String[] args) { | |
String name = "You and"; | |
System.out.println("All Character is: "+name.replaceAll("\\s","").length()); | |
} | |
} | |
//then output | |
All Character is: 6 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment