I have two strings: stringOne and stringTwo.
String stringOne = "JAVA";
String stringTwo = "DJDFKWAUERHFGJAVAORKFLASOWE";
I can easily locate if Java is in the second string (it is), where how would I index where it begins and ends? I want to initialize the beginning and end positions in integer variables: begPos = 14
and endPos = 18
. What method would I use to do this?
Somewhat the reverse of this, but I also have a third string:
String stringThree = " ";
It's a bunch of whitespace. I want to put "JAVA" in there according to the positions gained before. I can replace parts of a string with other parts of a string, but again I'm not sure how to replace a specific position. The end result should be:
String stringThree = " JAVA ";
Any ideas?