java - Getting an index from an array and converting it -


i novice programmer , stuck ages. have got array of strings , wanted hold of last word after splitting 5 words , converting interger array of strings. have tried out not close working. please how do this? :(. thanks

    string failsome = "tests run: 12,  failures: 4";      string[] words = failsome.split("\\s+");      (int = 0; < words.length; i++) {        integer.parseint(words[4]);        system.out.println(words[i]); 

}

i hope, understood want split failsome,

store in string array , want convert last value of array int,

then display

i hope work you,

string failsome = "tests run: 12,  failures: 4"; string[] words = failsome.split("\\s");//splitting goes here int lastindexofarray=(words.length)-1; int value=integer.parseint(words[lastindexofarray]); system.out.println(value);//if want print converted value 

output : 4

thanks


Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -