org.apache.lucene.util
Class StringHelper

java.lang.Object
  extended by org.apache.lucene.util.StringHelper

public abstract class StringHelper
extends Object

Methods for manipulating strings.


Field Summary
static StringInterner interner
          Expert: The StringInterner implementation used by Lucene.
 
Method Summary
static int bytesDifference(byte[] bytes1, int len1, byte[] bytes2, int len2)
          Compares two byte[] arrays, element by element, and returns the number of elements common to both arrays.
static String intern(String s)
          Return the same string object for all equal strings
static int stringDifference(String s1, String s2)
          Compares two strings, character by character, and returns the first position where the two strings differ from one another.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

interner

public static StringInterner interner
Expert: The StringInterner implementation used by Lucene. This shouldn't be changed to an incompatible implementation after other Lucene APIs have been used.

Method Detail

intern

public static String intern(String s)
Return the same string object for all equal strings


bytesDifference

public static final int bytesDifference(byte[] bytes1,
                                        int len1,
                                        byte[] bytes2,
                                        int len2)
Compares two byte[] arrays, element by element, and returns the number of elements common to both arrays.

Parameters:
bytes1 - The first byte[] to compare
bytes2 - The second byte[] to compare
Returns:
The number of common elements.

stringDifference

public static final int stringDifference(String s1,
                                         String s2)
Compares two strings, character by character, and returns the first position where the two strings differ from one another.

Parameters:
s1 - The first string to compare
s2 - The second string to compare
Returns:
The first position where the two strings differ.


Copyright © 2000-2010 Apache Software Foundation. All Rights Reserved.