org.apache.derby.impl.sql.compile
Class StringSlicer
java.lang.Object
org.apache.derby.impl.sql.compile.StringSlicer
- public class StringSlicer
- extends java.lang.Object
This utility class wraps a string, making it possible
to extract substrings, given byte offsets into the
original string.
Constructor Summary |
StringSlicer(java.lang.String sourceString)
Construct a StringSlicer from a String. |
Method Summary |
int |
getCharLength()
Get the byte length of the string. |
java.lang.String |
slice(int beginOffset,
int endOffset,
boolean trimflag)
Get the substring between two byte offsets.
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
charArray
private char[] charArray
charLength
private int charLength
StringSlicer
public StringSlicer(java.lang.String sourceString)
- Construct a StringSlicer from a String.
- Parameters:
sourceString
- Source string to be sliced.
getCharLength
public int getCharLength()
- Get the byte length of the string.
- Returns:
- byte length of the string.
slice
public java.lang.String slice(int beginOffset,
int endOffset,
boolean trimflag)
- Get the substring between two byte offsets.
If the beginning offset is past the end of the string,
returns null. If the ending offset is past the end of
the string, truncates the substring accordingly.
- Parameters:
beginOffset
- Start of substring.endOffset
- End of substring.trimflag
- true to trim leading and trailing spaces
- Returns:
- specified substring
Apache Derby V10.1 Engine Documentation - Copyright © 1997,2005 The Apache Software Foundation or its licensors, as applicable.