battle programminga forum for elite programmerswith extreme will powerto sharpen theire skills
 
HomeCalendarFAQSearchMemberlistUsergroupsRegisterLog in
Share | 
 

 java class that filter numbers out of a string

Go down 
AuthorMessage
Moti Barski

avatar

Posts : 238
Join date : 2011-08-02

PostSubject: java class that filter numbers out of a string   Mon Jul 30, 2018 11:20 am

Code:
public class Numerize {
    final static private String allnums = "0123456789";
    public  static  String filter(String s1){
        char[] arr = s1.toCharArray();
        String result="";
        for (char ot:arr) {
            if(allnums.contains(ot + "")){result+= ot;}
        }
        return result;
    }
}

🐷

_________________
MB over and out _______________________     
Back to top Go down
View user profile
 
java class that filter numbers out of a string
Back to top 
Page 1 of 1
 Similar topics
-
» EclipseIDE warns SeleneseTestCase Deprecated
» Getting the error msg 'Error: Could not find or load main class java-jar' while executing the selenium code in eclipse
» Cannot locate the class Select in web driver
» verifyTrue (FALSE) causes AssertionError: null
» Verify command when used with Java,JUNIT and Eclipse

Permissions in this forum:You cannot reply to topics in this forum
battle programmers alliance :: battle programming alliance :: battle programming-
Jump to: