Pretty much what I need to happen, is I need to take a string

Example

```
 String ln = "It's so pretty! &#55357;";

```

The idea, is we're taking this string, a converting the end of the line..

```
&#55357;

```

into

```
&#127037;

```

I can convert that easy enough, but the problem there can be multiple numbers to change. The string could be...

```
 String ln = "It's so pretty! &#55357;&#56357; But &#55468; &#55357;";

```

And I need to convert, every number in that line..

The purpose of this, is each one of those codes, is unicode for a character, but it's shorthanded, and not correct for the purpose that I need it to be.

* Every number is in the same format.. and will always be 5 characters long.
* Every code, starts with "&#" and ends with a semicolon.
* Every code, can be anywhere in the string

When I tried to create a method to convert the numbers, I pretty much split the string on "&#" and it works, for every case, except for when they aren't connected in series. For example,

```
String ln = "Gahh it's so pretty. &#55357;&#56845;&#55357;&#56845;&#55357;&#56874;";

```

It will solve that string, and convert all the numbers, and can recreate the string as it was originally, just with modified numbers. But it wouldn't recreate a string, with a gap in between number codes.

---

This is the code I have used.. like I said, it converts like its supposed to, just only in one case, and I haven't figured out how to make it work on all cases. 

```
public static void main(String args[]) {
    String ln = "Gahh it's so pretty. &#55357;&#56845;&#55357;&#56845;&#55357;&#56874;";
    //71680 + code present
    //Gahh it's so pretty. &#55357;&#56845;&#55357;&#56845;&#55357;&#56874;
    String tmp = ln;
    String[] codes = tmp.split("&#");
    System.out.println(ln);
    ArrayList<Integer> ids = new ArrayList<>();

    for (int i = 0; i < codes.length; i++) {
        codes[i] = codes[i].trim();
        if (codes[i].length() != 6)
            continue;
        if (codes[i].endsWith(";")) {
            codes[i] = codes[i].substring(0, codes[i].length()-1);
        }
        try {
            ids.add(Integer.parseInt(codes[i]) + 71680);

        } catch (NumberFormatException e) {
            System.err.println("Error in conversion: " + codes[i]);
        }
    }
    //System.out.println(Arrays.toString(codes));

    codes = tmp.split("&#\\d{5}");
    //System.out.println(Arrays.toString(codes));
    for (int i = 0; i < codes.length; i++) {
        //System.out.println(codes[i]);
        if (codes[i].equals(";")) {
            codes[i] = "&#"+ids.remove(0)+";";

        }
    }
    for (String s : codes)
        System.out.print(s);
    System.out.println();

}

```

I just need some input on this. If you're willing to correct a few things, I'd gladly accept the help, but honestly, I'm more interested in how you would approach this problem.