[xwiki-users] Problem with Groovy code
Hi, I want to split the words seperated by character "|". <% String[] sources=new String("hello|world").split("|"); for (i in 0..<sources.length) { print sources[i]+"<br/>" } %> but the result is: h e l l o | w o r l d I tried using String[] sources=new String("hello|world").split("\|"); but it gives me error. How to solve this problem? -- Ngô Thị Hồng Nga Mobile: 0935 176133
Ngo Thi Hong Nga wrote:
Hi, I want to split the words seperated by character "|".
<% String[] sources=new String("hello|world").split("|"); for (i in 0..<sources.length) { print sources[i]+"<br/>" } %>
but the result is: h e l l o | w o r l d I tried using String[] sources=new String("hello|world").split("\|"); but it gives me error. How to solve this problem?
split("[|]") -- Sergiu Dumitriu http://purl.org/net/sergiu/
participants (2)
-
Ngo Thi Hong Nga -
Sergiu Dumitriu