title: Url encode a part of a string in java
body: <p>I have a url in which I have few macros that I don't want to be encoded, but the remaining part should be. 
  For example - </p>
  
  <pre><code>https://example.net/adaf/${ABC}/asd/${WSC}/ 
  </code></pre>
  
  <p>should be encoded as </p>
  
  <pre><code>https%3A%2F%2Fexample.net%2Fadaf%2F${ABC}%2Fasd%2F${WSC}%2F
  </code></pre>
  
  <p><code>URLEncoder.encode(string, encoding)</code> encodes the entire string. I need a function of the sort - <code>encode(string, start, end, encoding)</code></p>
  
  <p>Is there any existing library which does this?</p>