www.element4solution.com

e4s.util
Class E4String

java.lang.Object
  extended by e4s.util.E4Object
      extended by e4s.util.E4String
All Implemented Interfaces:
java.lang.Comparable
Direct Known Subclasses:
CLASS_Name, CountryCode, CSS_Name, CurrencyCode, E4Client, E4CompanyGroup, E4CompanyUserId, E4DBColumnName, E4DBColumnType, E4DBFreeFieldName, E4DBFreeFieldType, E4DBTableName, E4DecimalSign, E4FrameName, E4FreeFieldDisplayMode, E4HintID, E4ID, E4InputFieldName, E4OverviewGroup, E4Permission, E4StringImage, E4TranslationDataID, Language

public class E4String
extends E4Object
implements java.lang.Comparable

Similar to a String datatype, but it is possible to inheritance sub classes from this type. It is used to build up user defined and generated classes for String values.

Since:
JDK 1.4
See Also:
E4ModuleDictionaryTypes, E4DBType, E4StringImage, E4Long

Field Summary
static java.lang.String CLASSNAME
           
protected  int m_maxsize
           
protected  boolean m_nullable
           
protected  java.lang.String m_string
           
 
Fields inherited from class e4s.util.E4Object
CRLF, E4S_CORE_SYSTEM_LANGUAGE, NBSP, NULLSTR, URL_ENCODING_CHARSET
 
Constructor Summary
E4String()
           
E4String(char ch)
           
E4String(char[] s)
           
E4String(char[] s, int maxsize)
           
E4String(char[] s, int maxsize, boolean nullable)
           
E4String(char ch, int maxsize)
           
E4String(char ch, int maxsize, boolean nullable)
           
E4String(E4String s)
           
E4String(E4String s, int len)
           
E4String(E4String s, int len, boolean nullable)
           
E4String(int maxsize)
           
E4String(int maxsize, boolean nullable)
           
E4String(java.lang.String s)
           
E4String(java.lang.StringBuffer s)
           
E4String(java.lang.StringBuffer s, int maxsize)
           
E4String(java.lang.StringBuffer s, int maxsize, boolean nullable)
           
E4String(java.lang.String s, int maxsize)
           
E4String(java.lang.String s, int maxsize, boolean nullable)
           
 
Method Summary
 boolean _equals(java.lang.String anotherString)
           
static java.lang.String _getSVNVersionString()
          Get version info string from subversion.
 char charAt(int pos)
           
 java.lang.Object clone()
           
 int compareTo(E4String anotherString)
           
 int compareTo(java.lang.Object anotherString)
           
 int compareTo(java.lang.String anotherString)
           
 int compareToIgnoreCase(E4String anotherString)
           
 int compareToIgnoreCase(java.lang.String anotherString)
           
 E4String concat(char ch)
           
 E4String concat(E4String str)
           
 E4String concat(int val)
           
 E4String concat(long val)
           
 E4String concat(java.lang.String str)
           
static java.lang.String cut(java.lang.String s, E4DBColumnInfo ci)
          Cut a string to the specified length.
static java.lang.String cut(java.lang.String s, int len)
          Cut a string to the specified length.
 boolean endsWith(E4String suffix)
           
 boolean endsWith(java.lang.String suffix)
           
 boolean equals(E4String anotherString)
           
 boolean equals(java.lang.String anotherString)
           
 boolean equalsIgnoreCase(E4String anotherString)
           
 boolean equalsIgnoreCase(java.lang.String anotherString)
           
static java.lang.String fixed(java.lang.String str, int len)
          Fill up a string with spaces (' '), so that the length will be len characters.
static java.lang.String fixedRight(java.lang.String str, int len)
          Fill up a string with spaces (' '), so that the length will be len characters.
 int getMaxSize()
          Return the maximum size for this string.
 boolean getNullable()
          Return the nullable status of this String.
 java.lang.String getString()
           
 int hashCode()
           
 int indexOf(char ch)
           
 int indexOf(char ch, int fromIndex)
           
 int indexOf(E4String str)
           
 int indexOf(E4String str, int fromIndex)
           
 int indexOf(java.lang.String str)
           
 int indexOf(java.lang.String str, int fromIndex)
           
 int lastIndexOf(char ch)
           
 int lastIndexOf(char ch, int fromIndex)
           
 int lastIndexOf(E4String str)
           
 int lastIndexOf(E4String str, int fromIndex)
           
 int lastIndexOf(java.lang.String str)
           
 int lastIndexOf(java.lang.String str, int fromIndex)
           
 E4String left(int places)
           
static java.lang.String left(java.lang.String s, int places)
          Get the left part of a string.
 int length()
           
static boolean matches(java.lang.String s, java.lang.String wildcards)
          Test, if a specified string including wildcards matches.
static boolean matchesIgnoreCase(java.lang.String s, java.lang.String wildcards)
          Test, if a specified string including wildcards matches.
 boolean regionMatches(boolean ignoreCase, int toffset, E4String other, int ooffset, int len)
           
 boolean regionMatches(boolean ignoreCase, int toffset, java.lang.String other, int ooffset, int len)
           
 boolean regionMatches(int toffset, E4String other, int ooffset, int len)
           
 boolean regionMatches(int toffset, java.lang.String other, int ooffset, int len)
           
static java.lang.String remove(java.lang.String str, java.lang.String source)
          Remove a substring within a string.
 E4String removeSpaces()
          Remove spaces from a String
static java.lang.String removeSpaces(java.lang.String s)
          Remove spaces from a String
 E4String replace(char oldChar, char newChar)
           
 E4String replace(E4String oldStr, E4String newStr)
           
static java.lang.String replace(java.lang.String str, char source, java.lang.String replace)
          Replace a substring within a string by another substring.
 E4String replace(java.lang.String oldStr, java.lang.String newStr)
           
static java.lang.String replace(java.lang.String str, java.lang.String source, java.lang.String replace)
          Replace a substring within a string by another substring.
static java.lang.String replaceIgnoreCase(java.lang.String str, java.lang.String source, java.lang.String replace)
          Replace a substring within a string by another substring.
 E4String right(int places)
           
static java.lang.String right(java.lang.String s, int places)
          Get the right part of a string.
 void setMaxSize(int maxsize)
          Defines and validates the mayimum size for this string.
 void setNullable(boolean nullable)
          Define the nullable status of this String.
 void setString(java.lang.String str)
           
 boolean startsWith(E4String prefix)
           
 boolean startsWith(E4String prefix, int toffset)
           
 boolean startsWith(java.lang.String prefix)
           
 boolean startsWith(java.lang.String prefix, int toffset)
           
 E4String substring(int i)
           
 E4String substring(int i1, int i2)
           
 char[] toCharArray()
           
 E4String toLowerCase()
           
 E4String toLowerCase(java.util.Locale locale)
           
 java.lang.String toString()
           
 E4String toUpperCase()
           
 E4String toUpperCase(java.util.Locale locale)
           
 E4String trim()
           
protected  void validate()
          If a maximum length is specified, validate if the String is smaller than that specified size and throw an Error if exceeds.
 
Methods inherited from class e4s.util.E4Object
Calendar, CName, CName, E4LabelApp, E4LabelApp, E4LabelApp, E4LabelApp, E4LabelApp, E4LabelApp, E4LabelNone, E4LabelNone, E4LabelNone, E4LabelNone, E4LabelSys, E4LabelSys, e4sCopyright, e4sVersion, encode, encode, encode, encodeHtml, encodeHtml, encodeHtml, encodeURL, encodeURL, encodeURL, finalize, getLINE, getTRACE, getTRACE, getTRACE, getTRACE, getTRACE, getTRACE, getTraceMemory, HtmlEncode, HtmlEncode, HtmlEncode, isdecimal, isdigit, isnotok, isnotok, isnumeric, isok, isok, isok, isok, lastCallingFunction, lastCallingFunction, lastCallingFunction, lastCallingFunction, lastCallingStack, mkdirs, null2nbsp, null2nbsp, null2nbsp, ok, ok, ok, ok, outPrintln, setLogFile4Trace, setTraceMemory, STACKTRACE, toDebug, toDouble, toFloat, toFloat, TRACE_CALLS, TRACE, TRACE, TRACE, TRACE, TRACE, TRACE, TRACE, TRACE, TRACE, TRACE, TRACE, TRACE, wait
 
Methods inherited from class java.lang.Object
equals, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

m_string

protected java.lang.String m_string

m_maxsize

protected int m_maxsize

m_nullable

protected boolean m_nullable

CLASSNAME

public static final java.lang.String CLASSNAME
Constructor Detail

E4String

public E4String()

E4String

public E4String(int maxsize)

E4String

public E4String(int maxsize,
                boolean nullable)

E4String

public E4String(java.lang.String s)

E4String

public E4String(java.lang.String s,
                int maxsize,
                boolean nullable)

E4String

public E4String(java.lang.String s,
                int maxsize)

E4String

public E4String(char[] s)

E4String

public E4String(char[] s,
                int maxsize)

E4String

public E4String(char[] s,
                int maxsize,
                boolean nullable)

E4String

public E4String(char ch)

E4String

public E4String(char ch,
                int maxsize)

E4String

public E4String(char ch,
                int maxsize,
                boolean nullable)

E4String

public E4String(E4String s)

E4String

public E4String(E4String s,
                int len)

E4String

public E4String(E4String s,
                int len,
                boolean nullable)

E4String

public E4String(java.lang.StringBuffer s)

E4String

public E4String(java.lang.StringBuffer s,
                int maxsize)

E4String

public E4String(java.lang.StringBuffer s,
                int maxsize,
                boolean nullable)
Method Detail

getString

public java.lang.String getString()

setString

public void setString(java.lang.String str)

toString

public java.lang.String toString()
Overrides:
toString in class E4Object

trim

public E4String trim()

substring

public E4String substring(int i)

substring

public E4String substring(int i1,
                          int i2)

charAt

public char charAt(int pos)

compareTo

public int compareTo(java.lang.String anotherString)

compareTo

public int compareTo(E4String anotherString)

compareTo

public int compareTo(java.lang.Object anotherString)
Specified by:
compareTo in interface java.lang.Comparable

compareToIgnoreCase

public int compareToIgnoreCase(java.lang.String anotherString)

compareToIgnoreCase

public int compareToIgnoreCase(E4String anotherString)

concat

public E4String concat(java.lang.String str)

concat

public E4String concat(char ch)

concat

public E4String concat(E4String str)

concat

public E4String concat(int val)

concat

public E4String concat(long val)

endsWith

public boolean endsWith(java.lang.String suffix)

endsWith

public boolean endsWith(E4String suffix)

equals

public boolean equals(java.lang.String anotherString)

_equals

public boolean _equals(java.lang.String anotherString)

equals

public boolean equals(E4String anotherString)

equalsIgnoreCase

public boolean equalsIgnoreCase(java.lang.String anotherString)

equalsIgnoreCase

public boolean equalsIgnoreCase(E4String anotherString)

indexOf

public int indexOf(char ch)

indexOf

public int indexOf(char ch,
                   int fromIndex)

indexOf

public int indexOf(java.lang.String str)

indexOf

public int indexOf(java.lang.String str,
                   int fromIndex)

indexOf

public int indexOf(E4String str)

indexOf

public int indexOf(E4String str,
                   int fromIndex)

lastIndexOf

public int lastIndexOf(char ch)

lastIndexOf

public int lastIndexOf(char ch,
                       int fromIndex)

lastIndexOf

public int lastIndexOf(java.lang.String str)

lastIndexOf

public int lastIndexOf(java.lang.String str,
                       int fromIndex)

lastIndexOf

public int lastIndexOf(E4String str)

lastIndexOf

public int lastIndexOf(E4String str,
                       int fromIndex)

length

public int length()

regionMatches

public boolean regionMatches(boolean ignoreCase,
                             int toffset,
                             java.lang.String other,
                             int ooffset,
                             int len)

regionMatches

public boolean regionMatches(boolean ignoreCase,
                             int toffset,
                             E4String other,
                             int ooffset,
                             int len)

regionMatches

public boolean regionMatches(int toffset,
                             java.lang.String other,
                             int ooffset,
                             int len)

regionMatches

public boolean regionMatches(int toffset,
                             E4String other,
                             int ooffset,
                             int len)

replace

public E4String replace(char oldChar,
                        char newChar)

removeSpaces

public E4String removeSpaces()
Remove spaces from a String

Parameters:
s - the string
Returns:
null if s is null, the string without spaces (mighr result in empty string)
See Also:
removeSpaces(String)

replace

public E4String replace(java.lang.String oldStr,
                        java.lang.String newStr)

replace

public E4String replace(E4String oldStr,
                        E4String newStr)

startsWith

public boolean startsWith(java.lang.String prefix)

startsWith

public boolean startsWith(E4String prefix)

startsWith

public boolean startsWith(java.lang.String prefix,
                          int toffset)

startsWith

public boolean startsWith(E4String prefix,
                          int toffset)

toLowerCase

public E4String toLowerCase()

toLowerCase

public E4String toLowerCase(java.util.Locale locale)

toUpperCase

public E4String toUpperCase()

toUpperCase

public E4String toUpperCase(java.util.Locale locale)

toCharArray

public char[] toCharArray()

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

getMaxSize

public int getMaxSize()
Return the maximum size for this string.

Returns:
the maximum size, or a value of -1 which indicates that there is no limitation
See Also:
setMaxSize(int), getNullable()

getNullable

public boolean getNullable()
Return the nullable status of this String.

Returns:
true means that null or empty values are allowed
See Also:
getMaxSize(), setNullable(boolean)

setNullable

public void setNullable(boolean nullable)
Define the nullable status of this String.

Parameters:
nullable - true means that null or empty values are allowed
See Also:
getNullable()

setMaxSize

public void setMaxSize(int maxsize)
Defines and validates the mayimum size for this string.

Parameters:
maxsize - the maximum size, or a value of -1 which indicates that there is no limitation
See Also:
getMaxSize(), validate()

validate

protected void validate()
If a maximum length is specified, validate if the String is smaller than that specified size and throw an Error if exceeds.


clone

public java.lang.Object clone()
Overrides:
clone in class java.lang.Object

right

public E4String right(int places)

left

public E4String left(int places)

fixed

public static java.lang.String fixed(java.lang.String str,
                                     int len)
Fill up a string with spaces (' '), so that the length will be len characters. Strings, longer than len characters, are not truncated.

Parameters:
str - the String
len - length to fill up
Returns:
the filled up string

fixedRight

public static java.lang.String fixedRight(java.lang.String str,
                                          int len)
Fill up a string with spaces (' '), so that the length will be len characters. Strings, longer than len characters, are not truncated.

Parameters:
str - the String
len - length to fill up
Returns:
the filled up string

cut

public static java.lang.String cut(java.lang.String s,
                                   int len)
Cut a string to the specified length.

Parameters:
s - the string
len - the length
Returns:
null if s was null or a string shorter or equal to specified length
See Also:
cut(String,e4s.db.E4DBColumnInfo)

cut

public static java.lang.String cut(java.lang.String s,
                                   E4DBColumnInfo ci)
Cut a string to the specified length.

Parameters:
s - the string
ci - a column info entry specifying the length
Returns:
null if s was null or a string shorter or equal to specified length
See Also:
cut(String,int)

remove

public static java.lang.String remove(java.lang.String str,
                                      java.lang.String source)
Remove a substring within a string.

Parameters:
str - the main string, where the replacement shall take place
source - the substring to search for
Returns:
null, if str was null, str if source was empty or not found, the replaced string
See Also:
replace(String,String,String)

replace

public static java.lang.String replace(java.lang.String str,
                                       java.lang.String source,
                                       java.lang.String replace)
Replace a substring within a string by another substring.

Parameters:
str - the main string, where the replacement shall take place
source - the substring to search for
replace - new replaced string, null if nothing to replace
Returns:
null, if str was null, str if source was empty or not found, the replaced string
See Also:
e4string#replace(String,String)

replaceIgnoreCase

public static java.lang.String replaceIgnoreCase(java.lang.String str,
                                                 java.lang.String source,
                                                 java.lang.String replace)
Replace a substring within a string by another substring.

Parameters:
str - the main string, where the replacement shall take place
source - the substring to search for
replace - new replaced string, null if nothing to replace
Returns:
null, if str was null, str if source was empty or not found, the replaced string
See Also:
e4string#replace(String,String), replace(char, char)

replace

public static java.lang.String replace(java.lang.String str,
                                       char source,
                                       java.lang.String replace)
Replace a substring within a string by another substring.

Parameters:
str - the main string, where the replacement shall take place
source - the substring to search for
replace - new replaced string, null if nothing to replace
Returns:
null, if str was null, str if source was empty or not found, the replaced string
See Also:
e4string#replace(String,String), e4string#replace(String,String,String)

right

public static java.lang.String right(java.lang.String s,
                                     int places)
Get the right part of a string.

Parameters:
places - number of characters to get
See Also:
left(String,int)

left

public static java.lang.String left(java.lang.String s,
                                    int places)
Get the left part of a string.

Parameters:
places - number of characters to get
See Also:
right(String,int)

matches

public static final boolean matches(java.lang.String s,
                                    java.lang.String wildcards)
Test, if a specified string including wildcards matches.

Parameters:
s - the string to be tested
wildcards - a wildcard expression containing asterix at the beginning and/or end
Returns:
false if wildcards is null or empty, true if string matches and false if not
See Also:
matchesIgnoreCase(String, String)

removeSpaces

public static java.lang.String removeSpaces(java.lang.String s)
Remove spaces from a String

Parameters:
s - the string
Returns:
null if s is null, the string without spaces (mighr result in empty string)

matchesIgnoreCase

public static final boolean matchesIgnoreCase(java.lang.String s,
                                              java.lang.String wildcards)
Test, if a specified string including wildcards matches. Not case sensitive.

Parameters:
s - the string to be tested
wildcards - a wildcard expression containing asterix at the beginning and/or end
Returns:
false if wildcards is null or empty, true if string matches and false if not
See Also:
matches(String, String)

_getSVNVersionString

public static java.lang.String _getSVNVersionString()
Get version info string from subversion.

Returns:
the version info string.
See Also:
E4Util.getRevisionCodeFromSVN(Class)

www.element4solution.com