Java String separation -
i stuck trying desired output. string separation problem facing in problem.
// inputs string input1 = "=divide(input!rc,input!r[1]c)"; // b1 string input2 = "=divide(multiply(input!r[-1]c,input!r[1]c),100)"; // b2 string input3 = "=input!r[-2]c + r[-1]c"; // b3 string input4 = "=divide(r[-2]c,input!r[-2]c)"; // b4 string input5 = "=r[-4]c+r[-1]c"; // b5now, here have replace rc proper b value.
example input5, @ r[-4]c , since input5, add together (-4) , (5) 1 , replace r[-4]c b1.
its going same all.
// desired output // =divide(input!b1,input!b2) // =divide(multiply(input!b1,input!b3),100) // =input!b1+calc!b2 // =divide(calc!b2,input!b2) // =calc!b1+calc!b4can give me thought how can accomplish ?
here's idea:
identify offset (1 input1, 2 input2 etc) each match of "r" ( "[" digit+ "]" )? "c" if digit+ != "" <index> = offset + tonumber(digit+) else <index> = offset replace match b<index>
java string stringbuilder stringtokenizer
No comments:
Post a Comment