I have a string that is built out of three parts. The word I want the string to be (changes), a seperating part (doesn\'t change) and the last part which changes. I want to
Perhaps thats what you are looking for:
String str="Stack Overflow - A place to ask stuff"; String newStr = str.substring(0, str.indexOf("-"));