Question: I want to split strings in the form of EADGBE or DADF#AD into separate strings, each containing either one letter or one letter plus a # sign. Is there any more elegant way than iterating through the string with a brute-force sort of approach?

String.split obviously relies on delimiters, which are then discarded, which is not much use to me at all - for a couple of minutes there I thought `split("[a-gA-G]#?");` was going to work, but no, that doesn't help at all - I almost want the opposite of that...

Answer: 
Brute force is likely to be your best option, both in terms of code and performance. 

Alternatively, you could use a `Matcher`

```
Pattern p = Pattern.compile("[a-gA-G]#?");
Matcher m = p.march(inputString);
List<String> matches = new ArrayList<String>();
while(m.find())
   matches.add(m.group());

```
How about that: add delimiters, then split:

This methods adds delimiters

```
private static String delimit(String in) {
  StringBuilder sb = new StringBuilder();
  for (int i = 0; i < in.length()-1; i++) {
    sb.append(in.charAt(i));
    if (in.charAt(i+1) != '#')
      sb.append(';');
  }
  return sb.toString();
}

```

To use it:

```
String[] notes = delimit("DADF#AD").split(";");

```