net.chayden.eliza
Class EString

java.lang.Object
  |
  +--net.chayden.eliza.EString

public class EString
extends java.lang.Object

Eliza string functions.


Constructor Summary
EString()
           
 
Method Summary
static int amatch(java.lang.String str, java.lang.String pat)
          Look for a match between the string and the pattern.
static java.lang.String compress(java.lang.String s)
          Compresses its input by: dropping space before space, comma, and period; adding space before question, if char before is not a space; and copying all others
static int count(java.lang.String s, char c)
          Count number of occurrances of c in str
static int findNum(java.lang.String str)
          Look for a number in the string.
static int findPat(java.lang.String str, java.lang.String pat)
          Search in successive positions of the string, looking for a match to the pattern.
static boolean match(java.lang.String str, java.lang.String pat, java.lang.String[] matches)
           
static java.lang.String pad(java.lang.String s)
          Pad by ensuring there are spaces before and after the sentence.
static java.lang.String translate(java.lang.String str, java.lang.String src, java.lang.String dest)
           
static java.lang.String trim(java.lang.String s)
          Trim off leading space
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EString

public EString()
Method Detail

amatch

public static int amatch(java.lang.String str,
                         java.lang.String pat)
Look for a match between the string and the pattern. Return count of maching characters before * or #. Return -1 if strings do not match.


findPat

public static int findPat(java.lang.String str,
                          java.lang.String pat)
Search in successive positions of the string, looking for a match to the pattern. Return the string position in str of the match, or -1 for no match.


findNum

public static int findNum(java.lang.String str)
Look for a number in the string. Return the number of digits at the beginning.


match

public static boolean match(java.lang.String str,
                            java.lang.String pat,
                            java.lang.String[] matches)

translate

public static java.lang.String translate(java.lang.String str,
                                         java.lang.String src,
                                         java.lang.String dest)

compress

public static java.lang.String compress(java.lang.String s)
Compresses its input by: dropping space before space, comma, and period; adding space before question, if char before is not a space; and copying all others


trim

public static java.lang.String trim(java.lang.String s)
Trim off leading space


pad

public static java.lang.String pad(java.lang.String s)
Pad by ensuring there are spaces before and after the sentence.


count

public static int count(java.lang.String s,
                        char c)
Count number of occurrances of c in str