Wednesday, 18 September 2013

Replace a part of the string after being found in the text of an array element

Replace a part of the string after being found in the text of an array
element

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;

No comments:

Post a Comment