Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void main(String[] args){
- expect("Fobbar", clean("3.4 Fobbar") );
- expect("Fob4bar", clean("3.4 Fob4bar") );
- expect("Fob4bar", clean(" 3.4 Fob4bar") );
- expect("Fob4bar", clean(" 3.4 Fob4bar") );
- expect("A Fob4bar", clean(" 3.A Fob4bar") );
- expect("Fob4bar", clean(" 3 Fob4bar") );
- expect("foobar 3.4 Fobbar", clean("foobar 3.4 Fobbar") );
- expect("foobar 3.4 Fobbar", clean(" foobar 3.4 Fobbar") );
- expect("Fobbar a3sdf ", clean(" 3.4 Fobbar a3sdf ") );
- expect("Fobbar a3sdf ", clean(" 3.4 Fobbar a3sdf ") );
- }
- public static String clean(String stringToClean){
- return stringToClean.replaceFirst("^\\s*[\\d\\.]*\\s*", "") ;
- }
- public static void expect(String expected, String actual ){
- if (expected.equals(actual))
- System.out.println("ok");
- else
- System.out.println("False. Expeced : " +expected + " but got "+ actual);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement