How to access the tokenized value in Java -
i have tokenized string, want access 1st,2nd,3rd value it.
can this?
thanks in advance!
here code
string cssvalue = webdriver.findelement(by.id(elementid)).getcssvalue("color"); string s = cssvalue; stringtokenizer st = new stringtokenizer(s, ",() "); while (st.hasmoretokens()) { log.info("token: "+st.nexttoken()); }
this might help:
string cssvalue = webdriver.findelement(by.id(elementid)).getcssvalue("color"); string [] s = cssvalue.split("rgb"); stringtokenizer st = new stringtokenizer(s[1], ",() "); list<integer> values = new arraylist<integer>(); int index=0; while (st.hasmoretokens()) { values.add(integer.parseint(st.nexttoken())); log.info("token: "+values.get(index)); index++; } integer [] = values.toarray(new integer[3]);
Comments
Post a Comment