title: Convert hybrid NSData to NSString
body: <p>My requirement is to convert an NSData stream that is written in 2 formats: hex bytes and normal string data (not sure what is correct name for it but if you have a look you can know). </p>
  
  <p>I am trying to find a way to fetch important stuff from it.</p>
  
  <p>Here is a sample:</p>
  
  <pre><code>bbbbbb02bbbbbb
  bbbbbb
  </code></pre>
  
  <p>From the above part, I can fetch 02 using approach shown <a href="https://stackoverflow.com/a/7520655/1506363">here</a>. (bbbbbb is simply a delimiter)</p>
  
  <p>However I am not sure about the following part - and I don't know what should I do to convert it into something sensible. Best I know it is an ascii character bytes formatted as xml. (note bbbbbb delimiter at the end)</p>
  
  <pre><code>3c3f786d....long pattern of hex....bbbbbb
  </code></pre>
  
  <p>I have already gone through <a href="https://stackoverflow.com/questions/2467844/convert-utf-8-encoded-nsdata-to-nsstring">this</a> but the utf-8-encoded nsdata to nsstring conversion seems to require entire nsdata while I have bytes due to fragments of data that I need.</p>
  
  <p>Can anyone put a sensible and cumulative approach to convert the entire pattern into required format ie bbbbbb02bbbbbb into 02, 3c3f786d.... into ascii xml and so on?</p>