Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

java program to Check given String is contians number or not

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);
   }
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #java #program #Check #String #contians #number
ADD COMMENT
Topic
Name
6+2 =