Class Misc

java.lang.Object
  |
  +--Misc

public class Misc
extends java.lang.Object

A non-instantiable class with miscellaneous static methods that illustrate the use of Java methods in SQL.


Method Summary
static int getNumber(java.lang.String s)
          Extracts the street number from an address line.
static java.lang.String getStreet(java.lang.String s)
          Extracts the "street" from an address line.
static java.lang.String stripLeadingBlanks(java.lang.String s)
          Removes leading blanks from a String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

stripLeadingBlanks

public static java.lang.String stripLeadingBlanks(java.lang.String s)
Removes leading blanks from a String.

getNumber

public static int getNumber(java.lang.String s)
Extracts the street number from an address line. E.g. Misc.getNumber(" 123 Main Street") == 123 Misc.getNumber(" Main Street") == 0 Misc.getNumber("") == 0 Misc.getNumber(" 123 ") == 123 Misc.getNumber(" Main 123 ") == 0
Parameters:
s - a string assumed to have address data
Returns:
a string with the extracted street number

getStreet

public static java.lang.String getStreet(java.lang.String s)
Extracts the "street" from an address line. E.g. Misc.getStreet(" 123 Main Street") == "Main Street" Misc.getStreet(" Main Street") == "Main Street" Misc.getStreet("") == "" Misc.getStreet(" 123 ") == "" Misc.getStreet(" Main 123 ") == "Main 123"
Parameters:
s - a string assumed to have address data
Returns:
a string with the extracted street name