StringHelper (Lucene 2.4.1 API)
Keywords: org.apache.lucene.util.StringHelper class

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.lucene.util
Class StringHelper

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

    public abstract class StringHelper

extends Object

Methods for manipulating strings. $Id: StringHelper.java 641303 2008-03-26 13:39:25Z mikemccand $

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 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`

Method Detail

### 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.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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