嗨,我有一個問題,我無法解決。 A已經以String的形式從jar清單中導出了pacakges,我想將它放在Map中,其中key是包的名稱,其餘信息在的值中。你會說這是蛋糕的平安,但讓我們告訴你我到底想做什麼。我有一個字符串,我小片從它Java String to Map。最好的辦法做到這一點
aQute.bnd.annotation;version="1.43.1",aQute.bnd.annotati
on.component;version="1.43.1",aQute.bnd.annotation.metatype;version="1.
43.1",aQute.bnd.ant;uses:="aQute.service.reporter,org.apache.tools.ant,
org.apache.tools.ant.taskdefs,org.apache.tools.ant.types";version="0.0.
0",aQute.bnd.build;version="2.1.0";uses:="aQute.bnd.maven.support,aQute
.bnd.osgi,aQute.bnd.service,aQute.bnd.service.action,aQute.bnd.version,
aQute.service.reporter",aQute.bnd.build.model;version="2.3";uses:="aQut
e.bnd.build.model.clauses,aQute.bnd.properties,aQute.bnd.version,org.os
gi.resource",aQute.bnd.build.model.clauses;version=2;uses:="aQute.bnd.h
eader",aQute.bnd.build.model.conversions;uses:="aQute.bnd.build.model,a
Qute.bnd.build.model.clauses,aQute.bnd.header,aQute.libg.tuple,org.osgi
.resource";version="0.0.0"
如果我把它分解的逗號(,)中的鍵會出現錯誤撕成小塊,因爲我們有
aQute.bnd.ant;uses:="aQute.service.reporter,org.apache.tools.ant,
org.apache.tools.ant.taskdefs,org.apache.tools.ant.types";version="0.0.
0"
其中使用條款我們也用逗號分隔依賴包的名稱。所以,上面的線必須在我的輸出映射爲:
Key: aQute.bnd.ant
Value: uses:="aQute.service.reporter,org.apache.tools.ant,
org.apache.tools.ant.taskdefs,org.apache.tools.ant.types";version="0.0.
0"
所以其字符串的方法或者正則表達式用來做我的工作?
你能指定想要的樣本輸出嗎 – Prateek