IndexOf « substring « Java Data Type Q&A

1. UpperCase problem, using IndexOf

Enter a line of text. No punctuation please. Java is the language. I have rephrased that line to read: Is the language java. Attempt:

 int x;
 String  sentence, first;

 System.out.println("\nEnter a line of text. ...

2. How can I parse operands and operators in my calculator project?

I'm working on a calculator project in my free time to keep up my Java skills during the summer, but I have run into a snag. So far everything is working ...

3. Why do I keep getting String out of Range?

return nameString.substring(nameString.indexOf(" ", 0), nameString.lastIndexOf(" ", 0));
Why is it keep returning an error? I just want to return the string from the first occurring space character, to the last occurring space ...

4. substring(IndexOf( ))

Yes Bart, you've got it right, but with one small difference. There is a slight difference in how substring uses the index you pass it, when you use substring(int, int) and substring(int) Parsing the last name will work nicely because substring with two parameters will start at the first index and go to "the last index minus one" (so the comma ...

5. Help in substring and indexOf function