Thanks for the quick reply.
But creates problem for my program.
My task is to
replace a word in a String.(Without using inbuilt functions like split or using Tokenizer).
Can anybody provide any hints how to do this.
I tried using a character array but it is becoming messy as converting a char array to string is proving a bit of problem.
Snippet of my awkward code
String str="I am having breakfast";
String replacableword="breakfast";
String newword="dinner";
//String newstring="";
// The output after replacing the word is stored in a char array called newstring
char newstring []=new char[40];
char arrayofwords[][]=new char[30][40];
int i=0;
int w=0;
int len=str.length();
a: while(i<len)
{
if((str.charAt(i))==' ')
{
i++;
}
int l=0;
while(str.charAt(i)!=' ')
{
arrayofwords[w][l]=str.charAt(i);
i++;l++;
if(i==len)
{
w++;
break a;
}
}
w++;
}
Thanks
Santosh >