拿给你 最近做的~
HashMap<String, Integer> map = new HashMap<String, Integer>();
String string = "break char do double else float for if int return void while + - * / % ++ -- > >= < <= == != && || ! << >> | & = "
+ "+= -= *= /= %= >>= <<= &= |= [ ] ( ) { } # ; , cout main iostream include printf using namespace std a b c d";
String string2 = "101 102 103 104 105 106 107 108 109 110 111 112 201 202 203 204 205 206 207 208 209 210 211"
+ " 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 301 302 303 304 305 306 307 308 309 310 311 312 313"
+ " 314 315 316 317 400 400 400 400";
String[] sting4 = string.split(" ");
String[] string3 = string2.split(" ");
int[] arrayInt = new int[string3.length];
{
for (int i = 0; i < arrayInt.length; i++) {
arrayInt[i] = Integer.parseInt(string3[i]);
map.put(sting4[i], arrayInt[i]);
}
char c = '"';
String string5 = String.valueOf(c);
map.put(string5, 318);
// System.out.println(map.toString());
}
// 判断是否数字
boolean isDigit(char ch) {
if (ch > 47 && ch < 58)
return true;
else
return false;
}
// 判断是否是字母
boolean isLeter(char ch) {
if ((ch > 64 && ch < 91) || (ch > 96 && ch < 123))
return true;
else
return false;
}
|