title: Transform string of text using JavaScript
body: <p>I am working on a code to transform a string of text into a Sentence case which would also retain Acronyms. I did explore similar posts in StackOverflow, however, I couldn't find the one which suits my requirement.</p>
  <p>I have already achieved the transformation of Acronyms and the first letter in the sentence. however, I ran into other issues like some letters in the sentence are still in Uppercase, especially texts in and after Double Quotes (&quot; &quot;) and camelcase texts.</p>
  <p>Below is the code I am currently working on, I would need someone to help me Optimize the code and to fix the issues.</p>
  <pre><code>String.prototype.toSentenceCase = function() {
    var i, j, str, lowers, uppers;
    str = this.replace(/(^\w{1}|\.\s*\w{1})/gi, function(txt) {
      return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
    });
  
    
    // Certain words such as initialisms or acronyms should be left uppercase
    uppers = ['Id', 'Tv', 'Nasa', 'Acronyms'];
    for (i = 0, j = uppers.length; i &lt; j; i++)
      str = str.replace(new RegExp('\\b' + uppers[i] + '\\b', 'g'),
        uppers[i].toUpperCase());
  
   // To remove Special caharacters like ':' and '?'
      str = str.replace(/[&quot;&quot;]/g,'');
      str = str.replace(/[?]/g,'');
      str = str.replace(/[:]/g,' - ');
  
  return str;
  }
  </code></pre>
  <p><strong>Input</strong>: play around: This is a &quot;String&quot; Of text, which needs to be cONVERTED to Sentence Case at the same time keeping the Acronyms as it is like Nasa.</p>
  <p><strong>Current Output</strong>: Play around - This is a String Of text, which needs to be cONVERTED to Sentence Case at the same time keeping the ACRONYMS as it is like NASA.</p>
  <p><strong>Expected Output</strong>: Play around - this is a string of text, which needs to be converted to sentence case at the same time keeping the ACRONYMS as it is like NASA.</p>