I have string 1-12.32;2-100.00;3-82.32; From this I need to extract the numbers based on my passing position value. If I pass 3, I would need 82.32, similarly if I pass 2, i need 100.00. I build a function as like below but it is not working as expected. Could someone correct this/help on this?
function String res(String str, String pos){
String res=str.substring(str.indexOf(pos+"-")+2, str.indexOf(";",str.indexOf(pos)));
return res;
}
where str= 1-12.32;2-100.00;3-82.32;
pos=1 (or) 2 (or) 3
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…