util
Class WordLimit

java.lang.Object
  |
  +--util.WordLimit

public class WordLimit
extends Object

A simple class to get the first n words out of a string. Written in 3 minutes by Stephen on a bet from Luke. See version 1.1 for the unmodified code.


Constructor Summary
WordLimit()
           
 
Method Summary
static Vector breakSentences(String text)
          This takes a long string of text, removes newlines or carriage returns, and returns a vector, each element of which is a single sentence.
static String cleanWords(String str, int i)
           
static String firstTokens(String s, int i, String tokens)
          like firstWords, except split string on the passed tokens.
static String firstWords(String s, int i)
           
static String lastTokens(String s, int i, String tokens)
           
static String lastWords(String s, int i)
           
static void main(String[] args)
           
static int makeInt(String num)
           
static int wordCount(String s)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WordLimit

public WordLimit()
Method Detail

firstWords

public static String firstWords(String s,
                                int i)

main

public static void main(String[] args)

lastWords

public static String lastWords(String s,
                               int i)

firstTokens

public static String firstTokens(String s,
                                 int i,
                                 String tokens)
like firstWords, except split string on the passed tokens.

lastTokens

public static String lastTokens(String s,
                                int i,
                                String tokens)

wordCount

public static int wordCount(String s)

cleanWords

public static String cleanWords(String str,
                                int i)

makeInt

public static int makeInt(String num)

breakSentences

public static Vector breakSentences(String text)
This takes a long string of text, removes newlines or carriage returns, and returns a vector, each element of which is a single sentence.
Parameters:
text - a String value
Returns:
a Vector value