brackets - Java: split text -


this question has answer here:

i need split text (string), text this:

[title],[description blablablablablabla] 

is there way this? need store in string[] 2 texts between brackets, separated ",".

you can use pattern , matcher:

string input = "[title],[description blablablablablabla]";  pattern pattern = pattern.compile("\\[(.*?)\\]"); matcher matcher = pattern.matcher(input); arraylist<string> stringlist = new arraylist<string>();  while(matcher.find()) {     stringlist.add(matcher.group(1)); }  //if need results stored in array of strings anyway. string[] stringarray = stringlist.toarray(new string[stringlist.size()]);  

Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

android - IBM Worklight 6.1 [Application Error] There was a network error (file:///android_asset/www/index.html) -