SHARE
TWEET

Spaces count

a guest Feb 14th, 2020 146 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public class Program
  2. {
  3.     public static void main(String[] args) {
  4.    
  5.       String text = "Here is the text";
  6.      
  7.       int count = text.split(" ").length - 1;
  8.  
  9.       if(count > 0){  
  10.           System.out.println("عدد المسافات:"+count);
  11.       }else{
  12.           System.out.println("لا توجد مسافات");
  13.       }
  14.      
  15.      
  16.     }
  17.    
  18.  
  19. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top