📄 stringtokenizer.java
字号:
// J2ME GPS Track
// Copyright (C) 2006 Dana Peters
// http://www.qcontinuum.org/gpstrack
package org.qcontinuum.gpstrack;
import java.util.Vector;
public class StringTokenizer {
public static Vector getVector(String tokenList, String separator) {
Vector tokens = new Vector();
int commaPos = 0;
String token = "";
int cnt = 0;
commaPos = tokenList.indexOf(separator);
while (commaPos > 0) {
commaPos = tokenList.indexOf(separator);
if (commaPos > 0) {
token = tokenList.substring(0, commaPos);
tokenList = tokenList.substring(commaPos,tokenList.length());
}
if (!token.startsWith(separator))
tokens.addElement(token);
while (tokenList.startsWith(separator)) {
cnt++;
if (cnt >= 2)
tokens.addElement("");
tokenList = tokenList.substring(1,tokenList.length());
commaPos = tokenList.indexOf(separator);
}
cnt = 0;
}
if (commaPos < 0) {
token = tokenList;
tokens.addElement(token);
}
return tokens;
}
public static String[] getArray(String tokenList, String separator) {
Vector tokens = getVector(tokenList,separator);
String[] st = new String[tokens.size()];
for (int i = 0; i <= tokens.size() - 1; i++)
st[i] = (String)tokens.elementAt(i);
return st;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -