Cannot split Base64 string the correct way
<p>I'm working on a C# client that receives Base64 files via a website.</p>

<p><em>It worked sometimes, but now I have a file that doesn't work because:</em></p>

<p>Lets say I have this as a Base64 string with some extra information added at the beginning <strong>shapered.png|data:image/png;base64,iVBORw0KGgoAAAANSUh <em>///</em>   EUgAAACAAAAAgCAYAblabla</strong></p>

<p>Then I do this in the C# code:</p>

<pre><code>var raw = base64.Split('/')[1]; //get raw data with type extention ,
var data = raw.Split(',')[1]; //get base64 data
var info = raw.Split(',')[0]; // gets type extention mp3 base64 
var ext = info.Split(';')[0]; // splits header mp3 only use this for comparison against malicous file
var name = base64.Split('|')[0]; //splits name info
</code></pre>

<p>Now I see in the debugger that it cuts all the information out after at the <strong>///</strong></p>

<p>Am I completely missing the point? 
I'd think that var raw = base64.Split('/')[1] would take the information after date:image/
and then that raw.Split(',')[1] takes out the png;base64 with only the raw data being left.</p>

<p>But it doesn't, it also takes out all the rest after the '/' out in the raw variable resulting in making the file corrupt.</p>

<p>Reason why I'm not splitting it at the ',' immediatly and split from there is to prevent files with a ',' in it to also work.</p>

<p><strong>It totally flew above my head</strong>, sorry guys!
I thought in one way that with [1] it would also take the rest of the "array".</p>

<pre><code>        string example = "im/noob/programmer";
        Console.WriteLine(example);
        string lol = example.Split('/')[1]; //this only outputs "noob"
        Console.WriteLine(lol);
</code></pre>