title: Replacing a part of a string with an initialized variable using the string replace function?
body: <p>I want to know how to use the replace function of a string to replace a part of a string with an initialized variable. I know you can use the replace function like <code>string.replace(0,5,"*****)</code> but that's not what I want to do. Let's say I have <code>string randString = "apple";</code>. How would I go about using the replace function to replace a string with the letter "e" from the word apple instead of using <code>string.replace(0,1,"e");</code> I want it to be something like this <code>string.replace(0,1,randString[4]);</code></p>
  
  <p>EDIT: I have a random string made of 0's and 1's and I want to replace a part of the string with this <code>randomStr.replace(0,1,bin[0][6]);</code> Where <code>bin[0]</code> is just one of many binary numbers that I have. <code>bin[0][6]</code> is the position of the last number at the end of the binary. For example bin[0] = 1001011 and bin[0][6] is 1.</p>