Methods Summary |
---|
public static java.lang.String | Hex(long b, int length)Returns a hex representation of long value with
leading zeros.
return Right(Long.toHexString(b), length).replace(' ", '0");
|
public static java.lang.String | Left(java.lang.String source, int length)Truncates or increases the specified string to the specified
length. If the source string is less that the desired length the
necessary number of spaces is added to the end of the string.
If the source string is more
than the desired length the necessary number of last characters is
removed.
if (length <= 0)
return "";
if (length <= source.length())
return source.substring(0, length);
else
return PadR(source, length);
|
public static java.lang.String | PadL(java.lang.String source, int length, java.lang.String what)Addes the specified substring to the beginning of the specified string
a few times until the length of the string becomes not less than the
specified length. If the length of the string is already more than
the specified length the resulting value if a string of asterisks with
the specified length.
if (length <= 0)
return "";
if (source.length() > length)
return PadL("", length, "*");
while (source.length() < length)
source = what + source;
return source;
|
public static java.lang.String | PadL(java.lang.String source, int length)Addes spaces to the beginning of the specified string
a few times until the length of the string becomes not less than the
specified length. If the length of the string is already more than
the specified length the resulting value if a string of asterisks with
the specified length.
return PadL(source, length, " ");
|
public static java.lang.String | PadR(java.lang.String source, int length, java.lang.String what)Appends the specified substring to the end of the specified string
a few times until the length of the string becomes not less than the
specified length. If the length of the string is already more than
the specified length the resulting value if a string of asterisks with
the specified length.
if (length <= 0)
return "";
if (source.length() > length)
return PadR("", length, "*");
while (source.length() < length)
source = source + what;
return source;
|
public static java.lang.String | PadR(java.lang.String source, int length)Appends spaces to the end of the specified string
a few times until the length of the string becomes not less than the
specified length. If the length of the string is already more than
the specified length the resulting value if a string of asterisks with
the specified length.
return PadR(source, length, " ");
|
public static java.lang.String | Right(java.lang.String source, int length)Truncates or increases the specified string to the specified
length. If the source string is less that the desired length the
necessary number of spaces is added to the beginning of the string.
If the source string is more
than the desired length the necessary number of first characters is
removed.
if (length <= 0)
return "";
if (length <= source.length())
return source.substring(source.length() - length, source.length());
else
return PadL(source, length);
|
public static int | countBytes(java.lang.String s)Returns a number of tokens in the string. Token delimiters are
spaces, colons, commas and tab characters.
return (new StringTokenizer(s, " :,\t")).countTokens();
|
public static java.lang.String | listVector(java.util.Vector v)Returns a content of the vector as a string where elements of the vector
are separated by tabs.
String s = "";
for (int i = 0; i < v.size(); i++)
s = s + (i + 1) + "\t" + v.elementAt(i) + "\n";
return s;
|
public static byte[] | str2bytes(java.lang.String s)Converts a string that is a list of bytes separated by
spaces, colons, commas and tab characters
(for example, 01,15,44,135 ) to byte array.
StringTokenizer t = new StringTokenizer(s, " :,\t");
byte[] buf = new byte[t.countTokens()];
int k = 0;
while (t.hasMoreTokens())
buf[k++] = Integer.decode(t.nextToken()).byteValue();
return buf;
|
public static void | wait(int delay)Suspends the current thread for the specified number of
milliseconds.
try {
Thread.sleep(delay);
}
catch (Exception e) {}
|