public abstract class

StringHelper

extends Object
java.lang.Object
   ↳ org.apache.lucene.util.StringHelper

Class Overview

Methods for manipulating strings.

Summary

Fields
public static StringInterner interner Expert: The StringInterner implementation used by Lucene.
Public Methods
final 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
final 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.
[Expand]
Inherited Methods
From class java.lang.Object

Fields

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.

Public Methods

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.

public static String intern (String s)

Return the same string object for all equal strings

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.