org.apache.lucene.util

## Class StringHelper

- java.lang.Object
- - org.apache.lucene.util.StringHelper

-     public abstract class StringHelper
      extends java.lang.Object

  Methods for manipulating strings. $Id: StringHelper.java 1039905 2010-11-28 16:58:14Z uschindler $

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static StringInterner` | `interner` Expert: The StringInterner implementation used by Lucene.

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `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 java.lang.String` | `intern(java.lang.String s)` Return the same string object for all equal strings
    `static int` | `stringDifference(java.lang.String s1, java.lang.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 java.lang.String intern(java.lang.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(java.lang.String s1,
                                                   java.lang.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-2016 Apache Software Foundation. All Rights Reserved.