It's simple:
test=test.Replace(" ","");
If you need to remove spaces, you will need regex :
using System.Text.RegularExpressions;
Regex r=new Regex("\\s+");
test=r.Replace(test,"");
Re: Why is there 3 elements in the array, not 2?
, (split arg 1 + 2), , John Jane:
["John", "", "Jane"]