com.aliasi.util
Class Strings

java.lang.Object
  extended by com.aliasi.util.Strings

public class Strings
extends Object

Static utility methods for processing strings, characters and string buffers.

Since:
LingPipe1.0
Version:
3.8
Author:
Bob Carpenter
See Also:
Character, String, StringBuilder

Field Summary
static String ASCII
          String representing the ASCII encoding for characters.
static char DEFAULT_SEPARATOR_CHAR
          The default separator character, a single space.
static String DEFAULT_SEPARATOR_STRING
          The default separator string.
static char[] EMPTY_CHAR_ARRAY
          The zero-length character array.
static String EMPTY_STRING
          The empty string.
static String[][] EMPTY_STRING_2D_ARRAY
          The zero-length two-dimensional array of strings.
static String[] EMPTY_STRING_ARRAY
          The zero-length string array.
static String Latin1
          String representing the Latin1 encoding for characters.
static char NBSP_CHAR
          The non-breakable space character.
static char NEWLINE_CHAR
          The newline character.
static String SINGLE_SPACE_STRING
          A string consisting of a single space.
static String UTF8
          String representing the UTF-8 encoding for characters.
 
Method Summary
static boolean allDigits(char[] cs, int start, int length)
          Returns true if all of the characters in the specified range are digits.
static boolean allDigits(String s)
          Returns true if all of the characters making up the specified string are digits.
static boolean allLetters(char[] chars)
          Returns true if all of the characters in the specified array are letters.
static boolean allLowerCase(char[] chars)
          Returns true if all of the characters in the specified array are lower case letters.
static boolean allLowerCase(CharSequence token)
          Returns true if the specified character sequence contains only lowercase letters.
static boolean allPunctuation(char[] chars)
          Returns true if all of the characters in the specified array are punctuation as specified by isPunctuation(char).
static boolean allPunctuation(String token)
          Returns true if all of the characters in the specified string are punctuation as specified by isPunctuation(char).
static boolean allSymbols(char[] cs)
          Returns true if none of the characters in the specified array are letters or digits.
static boolean allUpperCase(char[] chars)
          Returns true if all of the characters in the specified array are upper case letters.
static boolean allWhitespace(char[] ch, int start, int length)
          Returns true if the specified range of the specified character array only whitespace characters, as defined for characters by isWhitespace(char c).
static boolean allWhitespace(String s)
          Returns true if the specified string contains only whitespace characters.
static boolean allWhitespace(StringBuilder sb)
          Returns true if the specified buffer contains only whitespace characters.
static String bytesToHex(byte[] bytes)
          Returns a hexadecimal string-based representation of the specified byte array.
static String byteToHex(byte b)
          Deprecated. Use Integer.toHexString(b) instead.
static boolean capitalized(char[] chars)
          Returns true if the first character in the specified array is an upper case letter and all subsequent characters are lower case letters.
static void checkArgsStartEnd(char[] cs, int start, int end)
          Throws an exception if the start and end plus one indices are not in the range for the specified array of characters.
static String concatenate(Object[] xs)
          Concatenate the elements of the specified array as strings, separating with the default separator DEFAULT_SEPARATOR_STRING.
static String concatenate(Object[] xs, int start, int end)
          Concatenate the elements of the specified array as strings, starting at the object at the specified index and continuing through one element before the specified end index, separating with the default spacer DEFAULT_SEPARATOR_STRING.
static String concatenate(Object[] xs, int start, int end, String spacer)
          Concatenate the elements of the specified array as strings, starting at the object at the specified index and continuing through one element before the specified end index, separating with the specified spacer.
static String concatenate(Object[] xs, int start, String spacer)
          Concatenate the elements of the specified array as strings, starting at the object at the specified index and continuing through the rest of the string, separating with the specified string spacer.
static String concatenate(Object[] xs, String spacer)
          Concatenate the elements of the specified array as strings, separating with the specified string spacer.
static boolean containsChar(String s, char c)
          Returns true if the specified string contains an instance of the specified character.
static boolean containsDigits(char[] chars)
          Returns true if at least one of the characters in the specified array is a digit.
static boolean containsLetter(char[] chars)
          Returns true if at least one of the characters in the specified array is a letter.
static char deAccentLatin1(char c)
          Returns the equivalent de-accented character for characters in the Latin-1 (ISO-8859-1) range (0000-00FF).
static String deAccentLatin1(CharSequence cSeq)
          Returns the string constructed from the specified character sequence by deaccenting each of its characters.
static String decimalFormat(double x, String pattern, int length)
          Deprecated. Use DecimalFormat directly with a pattern, or use the newer Formatter class or String.format(String,Object[]) utility method instead.
static boolean equalCharSequence(CharSequence cs1, CharSequence cs2)
          Return true if the two character sequences have the same length and the same characters.
static String fit(String in, int length)
          Deprecated. Use java.util.Formatter instead.
static String functionArgs(String functionName, Object[] args)
          Return a string representation of a function applied to its arguments.
static String functionArgsList(Object[] args)
          Returns a string representation of the specified array as a function's argument list.
static int hashCode(CharSequence cSeq)
          Returns a hash code for a character sequence that is equivalent to the hash code generated for a its string yield.
static void indent(StringBuilder sb, int length)
          Appends an ``indentation'' to the specified string buffer, consisting of a newline character and the specified number of space characters to the specified string buffer.
static boolean isPunctuation(char c)
          Returns true if specified character is a punctuation character.
static boolean isWhitespace(char c)
          Returns true if specified character is a whitespace character.
static String msToString(long ms)
          Takes a time in milliseconds and returns an hours, minutes and seconds representation.
static String normalizeWhitespace(CharSequence cs)
          Returns a whitespace-normalized version of the specified character sequence.
static void normalizeWhitespace(CharSequence cs, StringBuilder sb)
          Appends a whitespace-normalized form of the specified character sequence into the specified string buffer.
static String nsToString(long ns)
          Takes a time in nanoseconds and returns an hours, minutes and seconds representation.
static String padding(int length)
          Returns a string consisting of the specified number of default separator characters DEFAULT_SEPARATOR_CHAR.
static void padding(StringBuilder sb, int length)
          Append the specified number of default separator characters DEFAULT_SEPARATOR_CHAR to the specified string buffer.
static String power(String s, int count)
          Returns the result of concatenating the specified number of copies of the specified string.
static String[] readArrayFrom(DataInput dataIn)
          Deprecated. Build this yourself using DataInput.readUTF().
static String reverse(CharSequence cs)
          Return the string that is the reverse of the specified character sequence.
static String save(String s)
          Deprecated. Use new String(s) instead.
static int sharedPrefixLength(String a, String b)
          Returns the length of the longest shared prefix of the two input strings.
static String[] split(String s, char c)
          Returns an array of substrings of the specified string, in order, with divisions before and after any instance of the specified character.
static String titleCase(String word)
          Returns a title-cased version of the specified word, which involves capitalizing the first character in the word if it is a letter.
static char[] toCharArray(CharSequence cSeq)
          Returns an array of characters corresponding to the specified character sequence.
static void writeArrayTo(DataOutput dataOut, String[] strings)
          Deprecated. Write your own with DataOutput.writeUTF(String) instead.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UTF8

public static String UTF8
String representing the UTF-8 encoding for characters.


Latin1

public static String Latin1
String representing the Latin1 encoding for characters.


ASCII

public static String ASCII
String representing the ASCII encoding for characters.


NBSP_CHAR

public static char NBSP_CHAR
The non-breakable space character.


NEWLINE_CHAR

public static char NEWLINE_CHAR
The newline character.


DEFAULT_SEPARATOR_CHAR

public static char DEFAULT_SEPARATOR_CHAR
The default separator character, a single space.


DEFAULT_SEPARATOR_STRING

public static String DEFAULT_SEPARATOR_STRING
The default separator string. The string is length 1, consisting of the default separator character DEFAULT_SEPARATOR_CHAR.


SINGLE_SPACE_STRING

public static final String SINGLE_SPACE_STRING
A string consisting of a single space.

See Also:
Constant Field Values

EMPTY_STRING

public static final String EMPTY_STRING
The empty string.

See Also:
Constant Field Values

EMPTY_CHAR_ARRAY

public static final char[] EMPTY_CHAR_ARRAY
The zero-length character array.


EMPTY_STRING_ARRAY

public static final String[] EMPTY_STRING_ARRAY
The zero-length string array.


EMPTY_STRING_2D_ARRAY

public static final String[][] EMPTY_STRING_2D_ARRAY
The zero-length two-dimensional array of strings.

Method Detail

save

@Deprecated
public static String save(String s)
Deprecated. Use new String(s) instead.

Return a copy of the specified string, trimming any underlying array characters to render the resulting string of minimal size..

Parameters:
s - String to copy.
Returns:
Copy of specified string.

reverse

public static String reverse(CharSequence cs)
Return the string that is the reverse of the specified character sequence.


containsChar

public static boolean containsChar(String s,
                                   char c)
Returns true if the specified string contains an instance of the specified character.

Parameters:
s - String to check for character.
c - Character.
Returns:
true if specified character occurs in specified string.

allWhitespace

public static boolean allWhitespace(StringBuilder sb)
Returns true if the specified buffer contains only whitespace characters.

Parameters:
sb - String buffer to test for whitespace.
Returns:
true if the specified buffer contains only whitespace characters.

allWhitespace

public static boolean allWhitespace(String s)
Returns true if the specified string contains only whitespace characters.

Parameters:
s - Stirng to test for whitespace.
Returns:
true if the specified string contains only whitespace characters.

allWhitespace

public static boolean allWhitespace(char[] ch,
                                    int start,
                                    int length)
Returns true if the specified range of the specified character array only whitespace characters, as defined for characters by isWhitespace(char c).

Parameters:
ch - Character array to test for whitespace characters in range.
start - Beginning of range to test.
length - Number of characters to test.
Returns:
true if the specified string contains only whitespace characters.

isWhitespace

public static boolean isWhitespace(char c)
Returns true if specified character is a whitespace character. The definition in Character.isWhitespace(char) is extended to include the unicode non-breakable space character (unicode 160).

Parameters:
c - Character to test.
Returns:
true if specified character is a whitespace.
See Also:
Character.isWhitespace(char)

normalizeWhitespace

public static void normalizeWhitespace(CharSequence cs,
                                       StringBuilder sb)
Appends a whitespace-normalized form of the specified character sequence into the specified string buffer. Initial and final whitespaces are not appended, and every other maximal sequence of contiguous whitespace is replaced with a single whitespace character. For instance, " a\tb\n" would append the following characters to "a b".

This command is useful for text inputs for web or GUI applications.

Parameters:
cs - Character sequence whose normalization is appended to the buffer.
sb - String buffer to which the normalized character sequence is appended.

normalizeWhitespace

public static String normalizeWhitespace(CharSequence cs)
Returns a whitespace-normalized version of the specified character sequence. See normalizeWhitespace(CharSequence,StringBuilder) for information on the normalization procedure.

Parameters:
cs - Character sequence to normalize.
Returns:
Normalized version of character sequence.

allDigits

public static boolean allDigits(String s)
Returns true if all of the characters making up the specified string are digits.

Parameters:
s - String to test.
Returns:
true if all of the characters making up the specified string are digits.

allDigits

public static boolean allDigits(char[] cs,
                                int start,
                                int length)
Returns true if all of the characters in the specified range are digits.

Parameters:
cs - Underlying characters to test.
start - Index of first character to test.
length - Number of characters to test.
Returns:
true if all of the characters making up the specified string are digits.

isPunctuation

public static boolean isPunctuation(char c)
Returns true if specified character is a punctuation character. Punctuation includes comma, period, exclamation point, question mark, colon and semicolon. Note that quotes and apostrophes are not considered punctuation by this method.

Parameters:
c - Character to test.
Returns:
true if specified character is a whitespace.
See Also:
Character

power

public static String power(String s,
                           int count)
Returns the result of concatenating the specified number of copies of the specified string. Note that there are no spaces inserted between the specified strings in the output.

Parameters:
s - String to concatenate.
count - Number of copies of string to concatenate.
Returns:
Specified string concatenated with itself the specified number of times.

concatenate

public static String concatenate(Object[] xs)
Concatenate the elements of the specified array as strings, separating with the default separator DEFAULT_SEPARATOR_STRING.

Parameters:
xs - Array of objects whose string representations are concatenated.
Returns:
Concatenation of string representations of specified objects separated by the default separator.

concatenate

public static String concatenate(Object[] xs,
                                 String spacer)
Concatenate the elements of the specified array as strings, separating with the specified string spacer.

Parameters:
xs - Array of objects whose string representations are concatenated.
spacer - String to insert between the string representations.
Returns:
Concatenation of string representations of specified objects separated by the specified spacer.

concatenate

public static String concatenate(Object[] xs,
                                 int start,
                                 String spacer)
Concatenate the elements of the specified array as strings, starting at the object at the specified index and continuing through the rest of the string, separating with the specified string spacer.

Parameters:
xs - Array of objects whose string representations are concatenated.
start - Index of first object to include.
spacer - String to insert between the string v * representations.
Returns:
Concatenation of string representations of specified objects separated by the specified spacer.

concatenate

public static String concatenate(Object[] xs,
                                 int start,
                                 int end)
Concatenate the elements of the specified array as strings, starting at the object at the specified index and continuing through one element before the specified end index, separating with the default spacer DEFAULT_SEPARATOR_STRING.

Parameters:
xs - Array of objects whose string representations are concatenated.
start - Index of first object to include.
end - The index of the last element to include plus 1.
Returns:
Concatenation of string representations of specified objects separated by the specified spacer.

concatenate

public static String concatenate(Object[] xs,
                                 int start,
                                 int end,
                                 String spacer)
Concatenate the elements of the specified array as strings, starting at the object at the specified index and continuing through one element before the specified end index, separating with the specified spacer.

Parameters:
xs - Array of objects whose string representations are concatenated.
start - Index of first object to include.
end - The index of the last element to include plus 1.
spacer - String to insert between the string representations.
Returns:
Concatenation of string representations of specified objects separated by the specified spacer.

indent

public static void indent(StringBuilder sb,
                          int length)
Appends an ``indentation'' to the specified string buffer, consisting of a newline character and the specified number of space characters to the specified string buffer.

Parameters:
sb - String buffer to indent.
length - Number of spaces to append after a newline to the specified string buffer.

fit

@Deprecated
public static String fit(String in,
                                    int length)
Deprecated. Use java.util.Formatter instead.

Return a string consisting of the initial segment of the specified string trimmed or padded with spaces to fit the specified length.

Parameters:
in - String to fit to specified length.
length - Length to fit.
Returns:
String fitted to specified length.

padding

public static String padding(int length)
Returns a string consisting of the specified number of default separator characters DEFAULT_SEPARATOR_CHAR.

Parameters:
length - Number of separator characters in returned string.
Returns:
String of specified number of default separator characters.

padding

public static void padding(StringBuilder sb,
                           int length)
Append the specified number of default separator characters DEFAULT_SEPARATOR_CHAR to the specified string buffer.

Parameters:
sb - String buffer to which to append specified number of default separator characters.
length - Number of separator characters to append.

functionArgs

public static String functionArgs(String functionName,
                                  Object[] args)
Return a string representation of a function applied to its arguments. Arguments will be converted to strings and separated with commas.

Parameters:
functionName - Name of function.
args - Arguments to function.
Returns:
String representation of specified function applied to specified arguments.

functionArgsList

public static String functionArgsList(Object[] args)
Returns a string representation of the specified array as a function's argument list. Each object is converted to a string, and the list of objects is separated by commas, and the whole is surrounded by round parentheses.

Parameters:
args - Objects to represent arguments.
Returns:
String representation of argument list.

allLowerCase

public static boolean allLowerCase(char[] chars)
Returns true if all of the characters in the specified array are lower case letters.

Parameters:
chars - Array of characters to test.
Returns:
true if all of the characters in the specified array are lower case letters.

allLowerCase

public static boolean allLowerCase(CharSequence token)
Returns true if the specified character sequence contains only lowercase letters. The test is performed by Character.isLowerCase(char). This is the same test as performed by allLowerCase(char[]).

Parameters:
token - Token to check.
Returns:
true if token is all lower-case.

allUpperCase

public static boolean allUpperCase(char[] chars)
Returns true if all of the characters in the specified array are upper case letters.

Parameters:
chars - Array of characters to test.
Returns:
true if all of the characters in the specified array are upper case letters.

allLetters

public static boolean allLetters(char[] chars)
Returns true if all of the characters in the specified array are letters.

Parameters:
chars - Array of characters to test.
Returns:
true if all of the characters in the specified array are letters.

allPunctuation

public static boolean allPunctuation(char[] chars)
Returns true if all of the characters in the specified array are punctuation as specified by isPunctuation(char).

Parameters:
chars - Array of characters to test.
Returns:
true if all of the characters in the specified array are punctuation.

allPunctuation

public static boolean allPunctuation(String token)
Returns true if all of the characters in the specified string are punctuation as specified by isPunctuation(char).

Parameters:
token - Token string to test.
Returns:
true if all of the characters in the specified string are punctuation.

split

public static String[] split(String s,
                             char c)
Returns an array of substrings of the specified string, in order, with divisions before and after any instance of the specified character. The returned array will always have at least one element. Elements in the returned array may be empty. The following examples illustrate this behavior:

CallResult
split("",' ') { "" }
split("a",' ') { "a" }
split("a b",' ') { "a", "b" }
split("aaa bb cccc",' ') { "aaa", "bb", "cccc" }
split(" a",' ') { "", "a" }
split("a ",' ') { "a", "" }
split(" a ",' ') { "", "a", "" }

Parameters:
s - String to split.
c - Character on which to split the string.
Returns:
The array of substrings resulting from splitting the specified string on the specified character.

allSymbols

public static boolean allSymbols(char[] cs)
Returns true if none of the characters in the specified array are letters or digits.

Parameters:
cs - Array of characters to test.
Returns:
true if none of the characters in the specified array are letters or digits.

containsDigits

public static boolean containsDigits(char[] chars)
Returns true if at least one of the characters in the specified array is a digit.

Parameters:
chars - Array of characters to test.
Returns:
true if at least one of the characters in the specified array is a digit.

containsLetter

public static boolean containsLetter(char[] chars)
Returns true if at least one of the characters in the specified array is a letter.

Parameters:
chars - Array of characters to test.
Returns:
true if at least one of the characters in the specified array is a letter.

capitalized

public static boolean capitalized(char[] chars)
Returns true if the first character in the specified array is an upper case letter and all subsequent characters are lower case letters.

Parameters:
chars - Array of characters to test.
Returns:
true if all of the characters in the specified array are lower case letters.

titleCase

public static String titleCase(String word)
Returns a title-cased version of the specified word, which involves capitalizing the first character in the word if it is a letter.

Parameters:
word - The word to convert to title case.
Returns:
Title cased version of specified word.

bytesToHex

public static String bytesToHex(byte[] bytes)
Returns a hexadecimal string-based representation of the specified byte array. Each byte is converted using byteToHex(byte) and the results are concatenated into the final string representation. Letter-based digits are lowercase.

Parameters:
bytes - Array of bytes to convert.
Returns:
The hexadecimal string-based representation of the specified bytes.

byteToHex

@Deprecated
public static String byteToHex(byte b)
Deprecated. Use Integer.toHexString(b) instead.

Converts the specified byte into a two-digit hexadecimal string representation. The byte is read as an unsigned value using Math.byteAsUnsigned(byte). The result will always be two characters, even if the unsigned byte value is less than 16. Letter-based digits are lowercase.

Parameters:
b - Byte to convert.
Returns:
Hexadecimal string representation of byte.

writeArrayTo

@Deprecated
public static void writeArrayTo(DataOutput dataOut,
                                           String[] strings)
                         throws IOException
Deprecated. Write your own with DataOutput.writeUTF(String) instead.

Writes an array of strings to a data output stream. This is done by writing out the length and then writing out the strings one at a time using the method DataOutput.writeUTF(String).

Parameters:
dataOut - Data output stream to which to write the string.
strings - Array of strings to write.
Throws:
IOException - If there is an I/O exception writing to the stream.

readArrayFrom

@Deprecated
public static String[] readArrayFrom(DataInput dataIn)
                              throws IOException
Deprecated. Build this yourself using DataInput.readUTF().

Reads an array of strings from a data input stream. See writeArrayTo(DataOutput,String[]) for information on the encoding used.

Parameters:
dataIn - Data input stream from which array is read.
Throws:
IOException - If there is an I/O exception reading from the stream.

decimalFormat

@Deprecated
public static String decimalFormat(double x,
                                              String pattern,
                                              int length)
Deprecated. Use DecimalFormat directly with a pattern, or use the newer Formatter class or String.format(String,Object[]) utility method instead.

Formats and pads a specified number with the specified decimal format pattern and pads it with leading spaces so that it is the specified length.

For a full description Java's decimal formatting pattern language, see DecimalFormat.

For English-style number formatting, the following patterns are examples that allow arbitrarily long whole-number portions, and exactly two decimal places. Examples for formatting two numbers are given in the last two columns.

PatternLeading Zero?Thousands Commas?2798.3890.391
"#,##0.00"yesyes2,798.390.39
"#0.00"yesno2798.390.39
"#,###.00"noyes2,798.39.39
"#.00"nono2798.39.39
If a variable-length decimal portion is required, the 0s may be replaced with #s. Note that the formatted numbers are rounded, not truncated; see BigDecimal.ROUND_HALF_EVEN for a full description.

Parameters:
x - The number to format.
pattern - The decimal pattern used to guide formatting.
length - Length of result in characters.
Throws:
IllegalArgumentException - If the length is not positive or the pattern is not well formed.

checkArgsStartEnd

public static void checkArgsStartEnd(char[] cs,
                                     int start,
                                     int end)
Throws an exception if the start and end plus one indices are not in the range for the specified array of characters.

Parameters:
cs - Array of characters.
start - Index of first character.
end - Index of one past last character.
Throws:
IndexOutOfBoundsException - If the specified indices are out of bounds of the specified character array.

toCharArray

public static char[] toCharArray(CharSequence cSeq)
Returns an array of characters corresponding to the specified character sequence. The result is a copy, so modifying it will not affect the argument sequence.

Parameters:
cSeq - Character sequence to convert.
Returns:
Array of characters from the specified character sequence.

nsToString

public static String nsToString(long ns)
Takes a time in nanoseconds and returns an hours, minutes and seconds representation. See msToString(long) for more information on output format.

Recall that 1 second = 1,000,000,000 nanoseconds.

Parameters:
ns - Amount of time in nanoseconds.

msToString

public static String msToString(long ms)
Takes a time in milliseconds and returns an hours, minutes and seconds representation. Fractional ms times are rounded down. Leading zeros and all-zero slots are removed. A table of input and output examples follows.

Recall that 1 second = 1000 milliseconds.

Input msOutput String
0:00
999:00
1001:01
32,000:32
61,0001:01
11,523,0003:12:03

Parameters:
ms - Time in milliseconds.
Returns:
String-based representation of time in hours, minutes and second format.

equalCharSequence

public static boolean equalCharSequence(CharSequence cs1,
                                        CharSequence cs2)
Return true if the two character sequences have the same length and the same characters. Recall that equality is not refined in the specification of CharSequence, but rather inherited from Object.equals(Object). The related method hashCode(CharSequence) returns hash codes consistent with this notion of equality.

Parameters:
cs1 - First character sequence.
cs2 - Second character sequence.
Returns:
true if the character sequences yield the same strings.

hashCode

public static int hashCode(CharSequence cSeq)
Returns a hash code for a character sequence that is equivalent to the hash code generated for a its string yield. Recall that the interface CharSequence does not refine the definition of equality beyond that of Object.equals(Object).

The return result is the same as would be produced by:

    hashCode(cSeq) = cSeq.toString().hashCode()
Recall that the CharSequence interface requires its CharSequence.toString() to return a string corresponding to its characters as returned by charAt(0),...,charAt(length()-1). This value can be defined directly by inspecting the hash code for strings:
      int h = 0;
      for (int i = 0; i < cSeq.length(); ++i)
          h = 31*h + cSeq.charAt(i);
      return h;

Parameters:
cSeq - The character sequence.
Returns:
The hash code for the specified character sequence.

deAccentLatin1

public static char deAccentLatin1(char c)
Returns the equivalent de-accented character for characters in the Latin-1 (ISO-8859-1) range (0000-00FF). Characters not in the Latin-1 range are returned as-is. Note that Latin-1 is a superset of ASCII, and the unsigned byte encoding of Latin-1 characters (ISO-8859-1) provides the same code points as Unicode for characters.

The unicode.org site supplies a complete Latin-1 Supplement, listing the code points for each character.

Parameters:
c - Character to de-accent.
Returns:
Equivalent character without accent.

deAccentLatin1

public static String deAccentLatin1(CharSequence cSeq)
Returns the string constructed from the specified character sequence by deaccenting each of its characters. See deAccentLatin1(char) for details of the de-accenting.

Parameters:
cSeq - Character sequence to de accent.
Returns:
De-accented version of input.

sharedPrefixLength

public static int sharedPrefixLength(String a,
                                     String b)
Returns the length of the longest shared prefix of the two input strings.

Parameters:
a - First string.
b - Second string.
Returns:
The length of the longest shared prefix of the two strings.