📄 util.java
字号:
/*
* Created on 2005-8-20 by pcy
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
package a.a.a.midp.io;
import java.util.Vector;
/**
* @author pcy
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
public abstract class Util {
/**
*
*/
public Util() {
super();
// TODO Auto-generated constructor stub
}
public static byte[] toCString(String string) {
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 String toJavaString(byte[] cString) {
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;
}
}
public static Vector getCommaSeparatedValues(String input) {
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;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -