Methods Summary |
---|
public static java.util.Vector | getCommaSeparatedValues(java.lang.String input)Create a vector of values from a string containing comma separated
values. The values cannot contain a comma. The output values will be
trimmed of whitespace. The vector may contain zero length strings
where there are 2 commas in a row or a comma at the end of the input
string.
Vector output = new Vector(5, 5);
int len;
int start;
int end;
len = input.length();
if (len == 0) {
return output;
}
for (start = 0; ; ) {
end = input.indexOf(',", start);
if (end == -1) {
break;
}
output.addElement(input.substring(start, end).trim());
start = end + 1;
}
end = len;
output.addElement(input.substring(start, end).trim());
return output;
|
public static byte[] | toCString(java.lang.String string)Converts string into a null terminated
byte array. Expects the characters in string
to be in th ASCII range (0-127 base 10).
int length = string.length();
byte[] cString = new byte[length + 1];
for (int i = 0; i < length; i++) {
cString[i] = (byte)string.charAt(i);
}
return cString;
|
public static java.lang.String | toJavaString(byte[] cString)Converts an ASCII null terminated byte array in to a
String . Expects the characters in byte array
to be in th Ascii range (0-127 base 10).
int i;
String jString;
// find the string length
for (i = 0; cString[i] != 0; i++);
try {
return new String(cString, 0, i, "ISO8859_1");
} catch (java.io.UnsupportedEncodingException e) {
return null;
}
|