public static void main(String[] args) {
String str = "Department of Pharmacology, Drug Development and Therapeutics, Institute of Biomedicine, University of Turku, Turku, Finland TOXPLUS SA, Spin off Company, Agiou Fanouriou 1, Nea Alikarnassos 71601, Heraklion 71003, Crete, Greece.";
testStringFG t = new testStringFG();
Map map = t.getAffiliationSplit(str);
Iterator entries = map.entrySet().iterator();
while (entries.hasNext()) {
Map.Entry entry = (Map.Entry) entries.next();
String key = entry.getKey().toString();
String value = (String)entry.getValue();
System.out.println("Key = " + key + ", Value = " + value);
}
}
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class testStringFG {
public Map getAffiliationSplit(String str) {
Map m = new HashMap();
String s = "PA CHN People's Republic of China HKG Hong-Kong OMA ";
String str1 = str.substring(0, str.length() - 1);// 去掉最后一个
String[] strFG = str1.split(",|;");//以,和;作为分割
for (int i = 0; i < strFG.length; i++) {
if (strFG[i].indexOf("College") > -1) {
m.put("school", strFG[i]);
}else if (strFG[i].indexOf("University") > -1) {
m.put("school", strFG[i]);
}
else if(strFG[i].indexOf("@") > -1){
m.put("email", strFG[i]);
}else if(s.indexOf(strFG[i]) > -1){
m.put("country", strFG[i]);
}else
m.put(i, strFG[i]);
}
return m;
}
}
public static void main(String[] args) { String str = "Department of Pharmacology, Drug Development and Therapeutics, Institute of Biomedicine, University of Turku, Turku, Finland TOXPLUS SA, Spin o