Just wondering if anyone knew off the top of their heads if there was much difference in doing the following:
String wibble = '<blah> blah blah </blah>.... <wibble> blah wibble blah </wibble> some more test here'; int i = wibble.lastIndexOf('>'); int j = wibble.lastIndexOf('>');
Opinions are great but data are better. I wrote a quick benchmark:
Test Code
Output
Conclusion
The version with a char is about 25% faster, but both versions execute very quickly so it probably won’t ever be a bottleneck in your code.