Skip to content

Instantly share code, notes, and snippets.

@agusmakmun
Created May 2, 2015 15:57
Show Gist options
  • Save agusmakmun/abe698e966c5b4aba3d2 to your computer and use it in GitHub Desktop.
Save agusmakmun/abe698e966c5b4aba3d2 to your computer and use it in GitHub Desktop.
Count Character Without Space is Java
/*
@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