Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Parse this string in Java

i'm new to Java . How can i obtain right values of each line (second value of the dash separated pair)

Autorul-Stefan

DenumireaCartii-Popovici

CuloareaCartii-Verde

GenulCartii-Religie

Limba-Rusa

SOLVED :

 String line = "Autorul-Stefan";
    String [] fields = line.split("-");
    fields[0] == "Autorul"
    fields[1] == "stefan"

1 Answers

String line = "Autorul-Stefan";
String [] fields = line.split("-");
// fields[0] == "Autorul"
// fields[1] == "stefan"
like image 85
yoprogramo Avatar answered Dec 07 '25 22:12

yoprogramo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!