For Example:
I got a string with value "CatIsEatingDinner".
I want to cut off the first 3 symbols and the last 6 so the remaining string would be "IsEating".
How do I do that? I have searched the whole www for this...
Printable View
For Example:
I got a string with value "CatIsEatingDinner".
I want to cut off the first 3 symbols and the last 6 so the remaining string would be "IsEating".
How do I do that? I have searched the whole www for this...
I'm that far:
public String removeCharAt(String s, int pos) {
return s.substring(0,pos)+s.substring(pos+1);
}
How do I make it to cut off the first 11 characters of the string?
It's much easy to get a subString fro the original string. But in that case, the length of the cutting parts should be fix, at the time.
Code:String str = "CatIsEatingDinner";
int length = str.length();
String temp = str.substring(3, (length - 6));
System.out.println(temp);