I love this place!
Ulf Dittmer wrote:the first if/else statement increments i, which is then used again in the second if statement. That way, i==charArray.length at the last character of the string, which causes an exception.
Gopi Chand Maddula wrote:
some code sample would be appreciated.
luck, db
There are no new questions, but there may be new answers.
Darryl Burke wrote:
Gopi Chand Maddula wrote:
some code sample would be appreciated.
er, aren't you supposed to DoYourOwnHomework?
Gopi Chand Maddula wrote:I am trying to code the functionality of substring method of String Class
My intention is to substring the given string without using any predefined methods.
your code doesn't look very much like the substring() method. Is it possible you meant split()?
I'm guessing this is a class assignment and you have been told not to use that.
Gopi Chand Maddula wrote:
Mike Simmons wrote: your code doesn't look very much like the substring() method. Is it possible you meant split()?
As i am thinking to divide the string into different words may be it would be split() too.
If the problem is to divide a sting into words (separated by spaces I guess)
that's not something you said in the original post. Are there other requirements?
Being able to define and communicate requirements is an important part of problem-solving... and of professional programming.
The moustache of a titan! The ad of a flea:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
|