org.apache.derby.impl.sql.compile
Class StringSlicer

java.lang.Object
  extended byorg.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.


Field Summary
private  char[] charArray
           
private  int charLength
           
 
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
 

Field Detail

charArray

private char[] charArray

charLength

private int charLength
Constructor Detail

StringSlicer

public StringSlicer(java.lang.String sourceString)
Construct a StringSlicer from a String.

Parameters:
sourceString - Source string to be sliced.
Method Detail

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

Built on Mon 2007-06-04 09:58:47+0400, from revision ???

Apache Derby V10.1 Engine Documentation - Copyright © 1997,2005 The Apache Software Foundation or its licensors, as applicable.