Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

java separate the numbers from string

        // string contains numbers
        String str = "The price of the book is $49";
        // extract digits only from strings
        String numberOnly = str.replaceAll("[^0-9]", "");
        // print the digitts
        System.out.println(numberOnly);
Comment

split number java

int num = 5542;
String number = String.valueOf(num);
for(int i = 0; i < number.length(); i++) {
    int j = Character.digit(number.charAt(i), 10);
    System.out.println("digit: " + j);
}
Comment

PREVIOUS NEXT
Code Example
Java :: get last index of array java 
Java :: get today date in java 8 
Java :: how to minimize jframe in java 
Java :: android studio, not loading url in webview 
Java :: find minimum number in array java 
Java :: java indexof array 
Java :: math.sin java 
Java :: kapt plugin 
Java :: java selenium implicitly wait 
Java :: what is use of static block in java 
Java :: string to hexstring In java 
Java :: string replace java 
Java :: how to get the average from a list in java 
Java :: select photo from camera android 
Java :: start activity for result deprecated 
Java :: difference between access specifiers and access modifiers in java 
Java :: string to string array java 
Java :: java how to get all threads 
Java :: modal css react 
Java :: double to string java 
Java :: android switch on change 
Java :: build tools java 
Java :: array to list java 
Java :: how to assert that an exception is thrown java 
Java :: imageview height based on screen size 
Java :: uninstall java ac 
Java :: isnull java 
Java :: android application manifest 
Java :: sort a string array java 
Java :: java string to double comma 
ADD CONTENT
Topic
Content
Source link
Name
3+1 =