I would like the fText string value int b=3, a, c=10; be changed into:
int _sc_b=3, _sc_a, _sc_c=10;
by using the text inside the array elements.
My code:
var fText = "int b=3, a, c=10;";
sc_var_int_temp[0] = "a";
sc_var_int_temp[1] = "b";
sc_var_int_temp[2] = "c";
for( var vi=0; vi<sc_var_int_temp.length; vi++ ){
//how would i do the replacing?
}//for
GOAL: fText value will be int _sc_b=3, _sc_a, _sc_c=10;
UPDATE: tried fText.replace(sc_var_int_temp[vi], "_sc_"+sc_var_int_temp[vi] ); but hangs the system ^^
as much as possible, i intend to do the replacing using the loop
UPDATE
I realized that the answer i accepted will not work properly when fText is:
var fText = "int b=3,a ,c=10;";
//not really seperated by a single whitespace
iornort?