Since I was trying to do this on an ArrayList of items similarly styled I ended up using the following code:
for (int image = 0; image < IBImages.size(); image++) {
IBImages.set(image, IBImages.get(image).split("~")[0].split("@")[0].split(".png")[0]);
}
If I have a list of images with the names
[am.sunrise.ios.png, [email protected], [email protected], am.sunrise.ios~ipad.png, [email protected]]
This allows me to split the string into 2 parts.
For example, "am.sunrise.ios~ipad.png" will be split into "am.sunrise.ios" and "~ipad.png" if I split on "~". I can just get the first part back by referencing [0]. Therefore I get what I'm looking for in one line of code.
Note that image is "am.sunrise.ios~ipad.png"
substringandendsWithmethods from theStringclass@2x.pngor any substring which starts with@till end?