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



Subscribe to Tutorials

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. good
View Tutorial          By: pardhuman at 2011-06-24 08:18:15

2. thanx it i very helpful 4 me as i m new with java
View Tutorial          By: akminder at 2011-08-09 05:09:19

3. Thanks for Your valuable Explanation.
View Tutorial          By: Srikanth at 2012-12-24 10:49:02

4. Brief but Comprehensive. Excellent Effort.
View Tutorial          By: Farooq at 2011-11-16 14:14:52

5. i have using struts tag in jsp ,
i have us

View Tutorial          By: sachin khatode at 2008-11-11 01:24:33

6. After a week of struggle, succeeded in sending mes
View Tutorial          By: Balaji G L at 2014-07-20 16:05:25

7. Hey nice article Brian W. Kernighan and/or Dennis
View Tutorial          By: butt at 2013-01-17 07:12:21

8. Help Me

I just run the ListPorts.ja

View Tutorial          By: srinivas at 2009-04-06 03:14:57

9. Hi,
The code runs fine on my emulator even

View Tutorial          By: Ramin at 2011-07-07 07:23:45

10. @Prab, no its 7 since it starts the counting at 0
View Tutorial          By: Shadowfaux at 2009-11-21 15:22:49