Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

how to find a number in a string java

public class ContainsExample {
   public static void main(String args[]){
      String sample = "krishna64";
      char[] chars = sample.toCharArray();
      StringBuilder sb = new StringBuilder();
      for(char c : chars){
         if(Character.isDigit(c)){
            sb.append(c);
         }
      }
      System.out.println(sb);
   }
}
Comment

PREVIOUS NEXT
Code Example
Java ::  
Java :: no main manifest attribute java 
Java ::  
Java ::  
Java :: java print text 
Java :: how to take an element out of an array at a certain index in java 
Java ::  
Java :: What is unreachable catch block error? 
::  
Java ::  
:: free news api for android 
Java ::  
Java ::  
Java :: Failed to determine a suitable driver class 
Java ::  
::  
:: java charsequence to string 
::  
Java :: Loop Structure in Java 
Java :: how to create an array in java 
:: java random 
:: java insert into arraylist 
Java ::  
Java ::  
Java ::  
:: float maximum value java 
:: copy array in java 
Java :: ! en java 
Java :: Get the last Friday of a month in Java 
::  
ADD CONTENT
Topic
Content
Source link
Name
9+6 =