0
如果我有像"(TIde Pods) OR (Pods) AND (myPods)"
這樣的字符串比如何將其拆分爲TIde Pods,Pods,myPods
?我如何在scala中以多個分隔符分割字符串?
scala>val s = "Tide POds OR Pods AND (abc ggk)"
s: String = Tide POds OR Pods AND (abc ggk)
scala>s.split("[() OR AND]")
res14: Array[String] = Array(Tide, P, ds, "", "", "", Pods, "", "", "", "", "", abc, ggk)
我想要Tide Array(POds,Pods,abc ggk)
。
你能包括輸入和期望的輸出更多的例子? – 2014-02-19 08:29:48