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. Your code is syntactically correct, but semantical
View Tutorial          By: mobinga at 2011-07-25 15:08:27

2. I am developing a system for paying electric bill
View Tutorial          By: Isaya at 2007-03-26 01:11:59

3. It is very helpful, I searched in many websites, b
View Tutorial          By: Anil Vaja at 2013-10-14 17:21:42

4. I am running it within NetBeans. I set a breakpoin
View Tutorial          By: PeteC at 2014-02-22 18:57:14

5. nice
View Tutorial          By: srfds at 2012-05-28 09:25:15

6. i have a question..i need to parse an xml file wit
View Tutorial          By: meltd0wn at 2011-09-30 08:36:51

7. Thanks a lot lot lot for this, but when I run the
View Tutorial          By: Kedjimo at 2011-10-06 06:13:10

8. good example
View Tutorial          By: WANT TO KNOW WHY WE USE APPEND at 2011-06-14 00:39:48

9. hi i want to send a message from my site to a phon
View Tutorial          By: dinesh at 2009-09-16 10:25:37

10. Of course you can use this in a web application. A
View Tutorial          By: Ramlak at 2008-09-17 08:24:21