|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object jut.lang.Strings
public final class Strings
static string utility methods.
Field Summary | |
---|---|
static int[] |
CHAR_HEX
table of integer values of the 16 characters used in hex strings, used for hex conversions. |
static char[] |
HEX_CHARS
table of the 16 characters used in hex strings, used for hex conversions. |
Method Summary | |
---|---|
static String |
hex(byte[] bytes)
returns the corresponding upper-case hex string for a byte array. |
static String |
hex(byte[] bytes,
int len)
returns the corresponding upper-case hex string for the first bytes of a byte array. |
static byte[] |
hex(String string)
returns the corresponding byte array for a hex string. this method accepts both upper case and lower case hex strings. for invalid input strings, an IllegalArgumentException is
thrown. |
static int |
indexOfDifference(String str1,
String str2)
Compares two Strings, and returns the index at which the Strings begin to differ. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final char[] HEX_CHARS
public static final int[] CHAR_HEX
Method Detail |
---|
public static String hex(byte[] bytes)
this method is performance optimized.
bytes
- - the byte array to create the hex string for.
public static String hex(byte[] bytes, int len)
this method is performance optimized.
bytes
- - the byte array to create the hex string from.len
- - the number of bytes to create the hex string for.
public static byte[] hex(String string)
IllegalArgumentException
is
thrown.
this method is performance optimized.
string
- - the hex string to create a byte array for.
public static int indexOfDifference(String str1, String str2)
For example, indexOfDifference("i am a machine", "i am a robot") -> 7
StringUtils.indexOfDifference(null, null) = -1 StringUtils.indexOfDifference("", "") = -1 StringUtils.indexOfDifference("", "abc") = 0 StringUtils.indexOfDifference("abc", "") = 0 StringUtils.indexOfDifference("abc", "abc") = -1 StringUtils.indexOfDifference("ab", "abxyz") = 2 StringUtils.indexOfDifference("abcde", "abxyz") = 2 StringUtils.indexOfDifference("abcde", "xyz") = 0this method is taken from the org.apache.commons.lang.StringUtils class and is copyright 2002-2005 The Apache Software Foundation, licensed under the Apache License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0
str1
- - the first String, may be nullstr2
- - the second String, may be null
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |