java - split in android is not working good -


i have string

"ok[separador]2272[dato]hospital issste 2             [dato]ok, realizado correctamente[fila]48612[dato]cfe yucalpeten[dato]ok, realizado correctamente[fila]48687[dato]impresos publicitarios[dato]ok, realizado correctamente[fila]" 

first step need have 2 string split [separador] need these 2 string:

ok 2272[dato]hospital issste 2             [dato]ok, realizado correctamente[fila]48612[dato]cfe yucalpeten[dato]ok, realizado correctamente[fila]48687[dato]impresos publicitarios[dato]ok, realizado correctamente[fila] 

then in code have this:

string[] arregloresultado=resultado.split("[separador]"); 

but array these values

[", k[, , , , , , , , , ]2272[, , t, ]hospital issste 2             [, , t, ]ok, r, , liz, , ,  c, , , , ct, m, nt, [fil, ]48612[, , t, ]cfe yucalpeten[, , t, ]ok, r, , liz, , ,  c, , , , ct, m, nt, [fil, ]48687[, , t, ]impresos publicitarios[, , t, ]ok, r, , liz, , ,  c, , , , ct, m, nt, [fil, ]"] 

how can result want? not loop.

[separador] contains special characters regexes. you'll split on s, e, p, a, r, d, and o. use:

string[] arregloresultado=resultado.split("\\[separador\\]"); 

the regex uses 1 backslash java literals require backslash backslash hence 2 backslashes.


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -