📄 globalstring.java
字号:
/**
* Description: operations for the a text string.
*
* @ Author Create/Modi Note
* Xiaofeng Xie Feb 22, 2001
* Xiaofeng Xie May 12, 2004
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* Please acknowledge the author(s) if you use this code in any way.
*
* @version 1.0
* @Since MAOS1.0
*/
package Global;
import java.io.*;
import java.util.*;
public class GlobalString {
public static final String EQUAL_TAG = "=";
/**
* Tokenize a String with given key.
* @param input the String to be tokenized.
* @param tokenKey the delimiters.
* @return a String array that include the elements of input string that
* divided by the tokenKey.
*/
public static String[] tokenize(String input , String tokenKey) {
Vector v = new Vector();
StringTokenizer t = new StringTokenizer(input, tokenKey);
String cmd[];
while (t.hasMoreTokens())
v.addElement(t.nextToken());
cmd = new String[v.size()];
for (int i = 0; i < cmd.length; i++)
cmd[i] = (String) v.elementAt(i);
return cmd;
}
static public int toInteger(Object oVal) throws Exception {
if(oVal==null) throw new Exception("Null string");
return new Integer(oVal.toString()).intValue();
}
static public double toDouble(Object oVal) throws Exception {
if(oVal==null) throw new Exception("Null string");
return new Double(oVal.toString()).doubleValue();
}
public static Object toObject(String key) throws Exception{
Class cls = Class.forName(key);
return cls.newInstance();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -