com.ch.odi.common
Class Strings

java.lang.Object
  |
  +--com.ch.odi.common.Strings

public class Strings
extends Object

Description: This class contains static functions that operate on Strings. Copyright: Copyright (c) 2002 Ortwin Glück


Constructor Summary
Strings()
           
 
Method Summary
static String cleanString(String s, int maxlen)
          Replaces single apostrophes (') with double apostrophes('') for use in SQL queries and cuts the string to a maximum length.
static String replace(String in, String s, String r)
          Replaces all occurences of a string with another string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Strings

public Strings()
Method Detail

cleanString

public static String cleanString(String s,
                                 int maxlen)
Replaces single apostrophes (') with double apostrophes('') for use in SQL queries and cuts the string to a maximum length. Sample: cleanString("I can't cookie", 9) ------> "I can''t cook"
Parameters:
s - The input string
maxlen - The maximum length

replace

public static String replace(String in,
                             String s,
                             String r)
Replaces all occurences of a string with another string. Sample: replace("Java will be smart", "will be", "is") ------> "Java is smart"
Parameters:
in - The input string to scan
s - The pattern to search for
r - The replacement for the pattern