All pastes #585313 Raw Edit

Mine

public text v1 · immutable
·published 2007-06-23 05:30 UTC
rendered paste body
else if ( string.contains( TIME_TOKENS.get( "in" ) ) )
			{
				while ( (pos1 = ((pos1 < -1) ? string.lastIndexOf( TIME_TOKENS.get( "in" ) ) : string.lastIndexOf( TIME_TOKENS.get( "in" ), pos1 - 1 ))) > -1 )
				{
					time_string = string.substring( pos1 + TIME_TOKENS.get( "in" ).length() ).trim();
					
					if ( time_string.contains( " to " ) )
					{
						time_string = time_string.substring( 0, (pos2 = time_string.indexOf( " to " )) ).trim();
					}
					
					String[] tokens = time_string.split( "\\s+" );
					if (tokens.length < 2)
					{
						continue;
					}

					if ( tokens[1].endsWith( "s" ) )
					{
						tokens[1] = tokens[1].substring( 0, tokens[1].length() - 1 );
					}
					if ( (tokens[0].equals( "an" ) || tokens[0].equals( "a" ))&& TIME_CONSTANTS.containsKey( tokens[1] ))
					{
						length = 1;
					}
					else
					{
						try
						{
							length = Double.parseDouble( tokens[0] );
						}
						catch ( Exception e )
						{
							continue;
						}
					}
					if ( TIME_CONSTANTS.containsKey( tokens[1] ) )
					{
						length *= TIME_CONSTANTS.get( tokens[1] );
						String message;

						if ( pos2 > 0 )
						{
							message = original.substring( original.toLowerCase().indexOf( " to " ) + 3 );
						}
						else
						{
							message = original.substring( original.toLowerCase().indexOf( " to " ) + 3, pos1 );
						}

						addTimedReminder( sender, nick, message.trim(), length );
						return;

					}
					else
					{
						continue;
					}
				}

				sendMessage( sender, "could not parse reminder request" );
			}