com.raj.extensions
Class Utils

java.lang.Object
  |
  +--com.raj.extensions.Utils

public class Utils
extends java.lang.Object

Useful static utility functions. These are:

Author:
Rajnish Bhaskar

Constructor Summary
Utils()
           
 
Method Summary
static int daysInMonths(int month, int year)
          returns the number of days in the given month, taking account of leapyears
static java.lang.String getDayName(int day)
          returns the name of the day corresponding to the given number, starting from 0.
static java.lang.String getMonth(int month)
          returns the name of the month corresponding to the given number starting from 0:
0 == January, 1 == February, and so on
static void prln()
          prints a blank line
static void prln(java.lang.String str)
          print the string str to standard output
static java.lang.String stripQuotes(java.lang.String input)
          this method strips all quotes (single (ASCII 39) and double (ASCII 34)) out of the string input and replaces them with ASCII codes 254 and 255 respectively.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Utils

public Utils()
Method Detail

stripQuotes

public static java.lang.String stripQuotes(java.lang.String input)
this method strips all quotes (single (ASCII 39) and double (ASCII 34)) out of the string input and replaces them with ASCII codes 254 and 255 respectively.

The process goes both ways, so it will decode any strings passed to it as well. Why? Well it's useful in something like an SQL query where you may be passing variables as parameters that may have quotes which mess up the SQL interpreter.

Parameters:
input - The string to have quotes stripped out of it
Returns:
the de-quoted string

getMonth

public static java.lang.String getMonth(int month)
returns the name of the month corresponding to the given number starting from 0:
0 == January, 1 == February, and so on

Parameters:
month - an int between 0 and 11
Returns:
the string representing that month

getDayName

public static java.lang.String getDayName(int day)
returns the name of the day corresponding to the given number, starting from 0.
0 == Sunday, 1 == Monday, and so on

Parameters:
day - an int between 0 and 6 representing the day of week
Returns:
the string representing that day

daysInMonths

public static int daysInMonths(int month,
                               int year)
returns the number of days in the given month, taking account of leapyears

Parameters:
month - the month which you want to get days for
year - the year in which this month is (needed for leapyear calcuations)
Returns:
the number of days in this month/year

prln

public static void prln(java.lang.String str)
print the string str to standard output

Parameters:
str - the String object to be printed

prln

public static void prln()
prints a blank line