org.apache.lucene.util

## Class StringHelper

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

-     public abstract class StringHelper
      extends Object

  Methods for manipulating strings.
  NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static int` | `bytesDifference(BytesRef left, BytesRef right)` Compares two `BytesRef`, element by element, and returns the number of elements common to both arrays.
    `static boolean` | `endsWith(BytesRef ref, BytesRef suffix)` Returns `true` iff the ref ends with the given suffix.
    `static boolean` | `equals(String s1, String s2)`
    `static Comparator<String>` | `getVersionComparator()`
    `static boolean` | `startsWith(BytesRef ref, BytesRef prefix)` Returns `true` iff the ref starts with the given prefix.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### bytesDifference

          public static int bytesDifference(BytesRef left,
                            BytesRef right)

      Compares two `BytesRef`, element by element, and returns the number of elements common to both arrays.
      Parameters:
        `left` - The first `BytesRef` to compare
        `right` - The second `BytesRef` to compare
      Returns:
        The number of common elements.

    - #### getVersionComparator

          public static Comparator<String> getVersionComparator()

      Returns:
        a Comparator over versioned strings such as X.YY.Z
      NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.

    - #### equals

          public static boolean equals(String s1,
                       String s2)

    - #### startsWith

          public static boolean startsWith(BytesRef ref,
                           BytesRef prefix)

      Returns `true` iff the ref starts with the given prefix. Otherwise `false`.
      Parameters:
        `ref` - the `BytesRef` to test
        `prefix` - the expected prefix
      Returns:
        Returns `true` iff the ref starts with the given prefix. Otherwise `false`.

    - #### endsWith

          public static boolean endsWith(BytesRef ref,
                         BytesRef suffix)

      Returns `true` iff the ref ends with the given suffix. Otherwise `false`.
      Parameters:
        `ref` - the `BytesRef` to test
        `suffix` - the expected suffix
      Returns:
        Returns `true` iff the ref ends with the given suffix. Otherwise `false`.

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