well that a bit annoying sorry i was presuming that it would work as standard java.
That means your going to have to do some dodgy loop function to go through your string i.e...
Code:
String str = "some words";
int getIndex = str.indexOf("words");
String tempFirstStr;
String tempSecondStr;
String tempStr = "";
if(getIndex >= 0)
{
if(getIndex >0)
{
tempStr = str.substring(0,getIndex);
tempStr += " crisps ";
tempStr += str.substring((getIndex + 5),str.length());
}
else
{
tempStr = " crisps "+ str.substring((getIndex + 5),str.length());
}
}
obviously this is simplistic as per your example youll probably have to come up with something a bit more complex.