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