Comment on Tutorial - indexOf( ) and lastIndexOf( ) in Java By Hong



Comment Added by : Kyle

Comment Added at : 2012-03-22 09:17:04

Comment on Tutorial : indexOf( ) and lastIndexOf( ) in Java By Hong
ASNWERING: what's the purpose of indexOf('t',10) ?

The purpose is to look for the index of the character 't' STARTING at index 10;

For instance:
String str = "hello world";
//Let's say you wanted to find the index of the second 'o'.
//You say:
System.out.println(str.indexOf('o',5));
//This searches the string for 'o' starting immediately after
// first 'o'. (Remember, Strings are simply arrays, and their
// indexes start out at 0.


View Tutorial



Related Tutorials

Program using concept of byte long short and int in java

Update contents of a file within a jar file

Tomcat and httpd configured in port 8080 and 80

Java File

Java String

Count number of vowels, consonants and digits in a String in Java

Reverse a number in Java

Student marks calculation program in Java

Handling Fractions in Java

Calculate gross salary in Java

Calculate average sale of the week in Java

Vector in Java - Sample Program

MultiLevel Inheritance sample in Java

Multiple Inheritance sample in Java

Java program using Method Overriding

Archived Comments

1. What if I wanted POST instead of GET?
View Tutorial          By: Otto at 2011-06-12 15:38:50

2. What is transient keyword in Java?


View Tutorial          By: Mohit at 2010-11-18 00:26:24

3. Your post was very informative... Thanks a lot. My
View Tutorial          By: Rohit Shaw at 2010-04-12 04:29:02

4. The above code works for me. When I run the progra
View Tutorial          By: Avinash at 2011-12-01 10:20:19

5. I want to know the difference between java and .ne
View Tutorial          By: Jack at 2010-06-10 07:40:35

6. This Tutorial website is very usefull in my java p
View Tutorial          By: V.GeorgeFernandas at 2012-11-26 13:20:59

7. Showing code with quote tags is pretty rubbish. :/
View Tutorial          By: Daniel Jonsson at 2011-09-01 14:01:04

8. HI, like some guys in this tutorial I get this pro
View Tutorial          By: omar carpio at 2009-09-06 13:17:37

9. Hii I m Ravi. This is a good example.
Here

View Tutorial          By: Ravi at 2011-02-17 09:09:06

10. THIS IS VERY SIMPLE AND EXCELENT PROGRAM.THIS PROG
View Tutorial          By: CHIRANJEET at 2011-02-05 12:13:54