Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.derby.iapi.util
Class StringUtil  view StringUtil download StringUtil.java

java.lang.Object
  extended byorg.apache.derby.iapi.util.StringUtil

public class StringUtil
extends java.lang.Object

A set of public static methods for dealing with Strings


Field Summary
private static char[] hex_table
           
 
Constructor Summary
StringUtil()
           
 
Method Summary
static java.lang.String formatForPrint(java.lang.String input)
          Used to print out a string for error messages, chops is off at 60 chars for historical reasons.
static byte[] fromHexString(java.lang.String s, int offset, int length)
          Convert a hexidecimal string generated by toHexString() back into a byte array.
static byte[] getAsciiBytes(java.lang.String input)
          Get 7-bit ASCII character array from input String.
static java.lang.String hexDump(byte[] data)
          Convert a byte array to a human-readable String for debugging purposes.
static boolean SQLEqualsIgnoreCase(java.lang.String s1, java.lang.String s2)
          Compares two strings Strings will be uppercased in english and compared equivalent to s1.equalsIgnoreCase(s2) throws NPE if s1 is null
static java.lang.String SQLToLowerCase(java.lang.String s)
          Convert string to lowercase Return java.util.Locale.ENGLISH lowercasing
static java.lang.String SQLToUpperCase(java.lang.String s)
          Convert string to uppercase Always use the java.util.ENGLISH locale
static java.lang.String toHexString(byte[] data, int offset, int length)
          Convert a byte array to a String with a hexidecimal format.
static java.lang.String[] toStringArray(java.lang.Object[] objArray)
          A method that receive an array of Objects and return a String array representation of that array.
static java.lang.String trimTrailing(java.lang.String str)
          Trim off trailing blanks but not leading blanks
static java.lang.String truncate(java.lang.String value, int length)
          Truncate a String to the given length with no warnings or error raised if it is bigger.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

hex_table

private static char[] hex_table
Constructor Detail

StringUtil

public StringUtil()
Method Detail

formatForPrint

public static final java.lang.String formatForPrint(java.lang.String input)
Used to print out a string for error messages, chops is off at 60 chars for historical reasons.


toStringArray

public static java.lang.String[] toStringArray(java.lang.Object[] objArray)
A method that receive an array of Objects and return a String array representation of that array.


getAsciiBytes

public static byte[] getAsciiBytes(java.lang.String input)
Get 7-bit ASCII character array from input String. The lower 7 bits of each character in the input string is assumed to be the ASCII character value. Hexadecimal - Character | 00 NUL| 01 SOH| 02 STX| 03 ETX| 04 EOT| 05 ENQ| 06 ACK| 07 BEL| | 08 BS | 09 HT | 0A NL | 0B VT | 0C NP | 0D CR | 0E SO | 0F SI | | 10 DLE| 11 DC1| 12 DC2| 13 DC3| 14 DC4| 15 NAK| 16 SYN| 17 ETB| | 18 CAN| 19 EM | 1A SUB| 1B ESC| 1C FS | 1D GS | 1E RS | 1F US | | 20 SP | 21 ! | 22 " | 23 # | 24 $ | 25 % | 26 & | 27 ' | | 28 ( | 29 ) | 2A * | 2B + | 2C , | 2D - | 2E . | 2F / | | 30 0 | 31 1 | 32 2 | 33 3 | 34 4 | 35 5 | 36 6 | 37 7 | | 38 8 | 39 9 | 3A : | 3B ; | 3C < | 3D = | 3E > | 3F ? | | 40 @ | 41 A | 42 B | 43 C | 44 D | 45 E | 46 F | 47 G | | 48 H | 49 I | 4A J | 4B K | 4C L | 4D M | 4E N | 4F O | | 50 P | 51 Q | 52 R | 53 S | 54 T | 55 U | 56 V | 57 W | | 58 X | 59 Y | 5A Z | 5B [ | 5C \ | 5D ] | 5E ^ | 5F _ | | 60 ` | 61 a | 62 b | 63 c | 64 d | 65 e | 66 f | 67 g | | 68 h | 69 i | 6A j | 6B k | 6C l | 6D m | 6E n | 6F o | | 70 p | 71 q | 72 r | 73 s | 74 t | 75 u | 76 v | 77 w | | 78 x | 79 y | 7A z | 7B { | 7C | | 7D } | 7E ~ | 7F DEL|


trimTrailing

public static java.lang.String trimTrailing(java.lang.String str)
Trim off trailing blanks but not leading blanks


truncate

public static java.lang.String truncate(java.lang.String value,
                                        int length)
Truncate a String to the given length with no warnings or error raised if it is bigger.


toHexString

public static java.lang.String toHexString(byte[] data,
                                           int offset,
                                           int length)
Convert a byte array to a String with a hexidecimal format. The String may be converted back to a byte array using fromHexString.
For each byte (b) two characaters are generated, the first character represents the high nibble (4 bits) in hexidecimal (b & 0xf0), the second character represents the low nibble (b & 0x0f).
The byte at data[offset] is represented by the first two characters in the returned String.


fromHexString

public static byte[] fromHexString(java.lang.String s,
                                   int offset,
                                   int length)
Convert a hexidecimal string generated by toHexString() back into a byte array.


hexDump

public static java.lang.String hexDump(byte[] data)
Convert a byte array to a human-readable String for debugging purposes.


SQLToUpperCase

public static java.lang.String SQLToUpperCase(java.lang.String s)
Convert string to uppercase Always use the java.util.ENGLISH locale


SQLToLowerCase

public static java.lang.String SQLToLowerCase(java.lang.String s)
Convert string to lowercase Return java.util.Locale.ENGLISH lowercasing


SQLEqualsIgnoreCase

public static boolean SQLEqualsIgnoreCase(java.lang.String s1,
                                          java.lang.String s2)
Compares two strings Strings will be uppercased in english and compared equivalent to s1.equalsIgnoreCase(s2) throws NPE if s1 is null