
how to trim string till indexof the string

Hi there, As you described your question, I guess this is what you need to do .
Please do try this
class TrimTill { private void trimTillIndex(String str,int sIndex,int eIndex) { String output = str.substring(sIndex, eIndex); System.out.println(output); } public static void main(String\u005B\u005D args) { TrimTill tt = new TrimTill(); tt.trimTillIndex("Hello There", 6, 11); } }
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.