jodd.util
Class CharUtil

java.lang.Object
  extended byjodd.util.CharUtil

public class CharUtil
extends java.lang.Object

Various character utilities.


Constructor Summary
CharUtil()
           
 
Method Summary
static boolean equals(char c, char[] match)
          Match if character equals to any of the given character.
static int findFirstAny(char[] source, int index, char[] match)
          Finds index of the first character in given array the matches any from the given set of characters.
static int findFirstDiff(char[] source, int index, char[] match)
          Finds index of the first character in given array the differes from the given set of characters.
static byte[] toByteArray(char[] carr)
          Converts char array into byte array.
static char[] toCharArray(byte[] barr)
          Converts byte array to char array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CharUtil

public CharUtil()
Method Detail

toByteArray

public static byte[] toByteArray(char[] carr)
Converts char array into byte array. Chars are truncated to byte size.

Parameters:
carr - char array to convert from
Returns:
byte array

toCharArray

public static char[] toCharArray(byte[] barr)
Converts byte array to char array.

Parameters:
barr - byte array to covnert from
Returns:
converted char array

equals

public static boolean equals(char c,
                             char[] match)
Match if character equals to any of the given character.

Parameters:
c - input character
match - array of matching characters
Returns:
true if characters match any chararacter from given array, otherwise false

findFirstAny

public static int findFirstAny(char[] source,
                               int index,
                               char[] match)
Finds index of the first character in given array the matches any from the given set of characters.

Parameters:
source - source to examine
index - starting index
match - array of characters to match
Returns:
index of matched character or -1

findFirstDiff

public static int findFirstDiff(char[] source,
                                int index,
                                char[] match)
Finds index of the first character in given array the differes from the given set of characters.

Parameters:
source - source to examine
index - starting index
match - array of characters to match
Returns:
index of matched character or -1


Jodd v0.24.5 Javadoc