Couple of things I usually do;

- Have a final static empty string which is returned if s is empty or null.
- Add the delimiter in every iteration of the loop then delete the last delimiter outside of the loop, that way it avoids instructions being executed on each iteration.