Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Main
- {
- static int jahr( final String text0 )
- {
- final String text = text0.trim();
- final int pos = text.indexOf( '-', 1 );
- final String jahr =
- text.substring( 0, pos );
- return Integer.valueOf( jahr ); }
- public static void main( String[] args )
- {
- System.out.println
- ( jahr( "2010-12-1" ) );
- System.out.println
- ( jahr( "333-12-1" ) );
- System.out.println
- ( jahr( "-333-12-1" ) );
- System.out.println
- ( jahr( " 2010-12-1 " ) );
- System.out.println
- ( jahr( " 333-12-1 " ) );
- System.out.println
- ( jahr( " -333-12-1 " ) );
- System.out.println
- ( jahr( "1-12-1" ) );
- System.out.println
- ( jahr( "-1-12-1" ) );
- }}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement