Picking String values and separating them

0

Ex:

(TextView) result="text1; text2; text3; text4";

I want to get them in sequence and do it in the following way, so I can then manipulate them separately.

String tx1="texto1";
String tx2="texto2";
String tx3="texto3";
String tx4="text4";

    
asked by anonymous 18.08.2014 / 01:14

1 answer

2

Do this:

String [] pedaços = resultado.split(";");

Each item in the pedaços array will have one of the texts between the semicolons. Example:

Log.v("Teste", "Texto 1 = " + pedaços[0]); // Imprime Texto 1 = texto1
    
18.08.2014 / 01:31