title: What is a good way to split strings here?
body: <p>I have the following string:<br>
  <code>A:B:1111;domain:80;a;b</code><br>
  The <code>A</code> is optional so <code>B:1111;domain:80;a;b</code> is also valid input.<br>
  The <code>:80</code> is optional as well so <code>B:1111;domain;a;b</code> or <code>:1111;domain;a;b</code> are also valid input<br>
  What I want is to end up with a <code>String[]</code> that has:  </p>
  
  <pre><code>s[0] = "A";  
  s[1] = "B";  
  s[2] = "1111";  
  s[3] = "domain:80"  
  s[4] = "a"  
  s[5] = "b"  
  </code></pre>
  
  <p>I did this as follows:  </p>
  
  <pre><code>List&lt;String&gt; tokens = new ArrayList&lt;String&gt;();  
  String[] values = s.split(";");  
  String[] actions = values[0].split(":");   
  
  for(String a:actions){  
      tokens.add(a);  
  }  
  //Start from 1 to skip A:B:1111
  for(int i = 1; i &lt; values.length; i++){  
      tokens.add(values[i]);  
  }  
  String[] finalResult = tokens.toArray();
  </code></pre>
  
  <p>I was wondering is there a better way to do this? How else could I do this more efficiently?  </p>