Home | Ajax | BioInformatics | Dojo | EAI | EJB | Hibernate | J2ME | Java | Java Glossary | Java Servlets | JavaScript | Jboss | JDBC | JDO | Jmeter | JSF | JSP | JUnit | Maven | MySQL | Spring Framework | SQL | Struts | Technology | WAP | Web Services | XML


 
  
 
Programming Tutorials: Ajax | Articles | JSP | Bioinformatics | Database | Free Books | Hibernate | J2EE | J2ME | Java | JavaScript | JDBC | JMS | Linux | MS Technology | PHP | RMI | Web-Services | Servlets | Struts | UML
 

 
Facing Programming Problem?
Ask Questions?, Browse Latest Questions, Question-Answer Guidelines
Java
  JDO Tutorials
  EAI Articles
  Struts Tutorials
  Java Tutorials
  Java Certification
  Java Applet
Questions
Comments

String indexOf(int ch, int fromIndex)

                         

In this section, you will get the detailed explanation about the indexOf(int ch, int fromIndex) method of String class. We are going to use indexOf(int ch, int fromIndex) method of String class in Java. The description of the code is given below for the usage of the method.

Description of the code:

Here, you will get to know about the
indexOf(int ch, int fromIndex) method through the following java program. In the program code given below, we have taken a String. To find the index of any character in a string we have applied indexOf(int ch, int fromIndex); method and then we have passed the character from a string in that with the index number to find its index starting from the specified index as shown in the output. You must be observing in the output that we have also taken the ASCII value of small "b" which is 98 with the index number. Hence its also giving the same result.

NOTE: This method returns the index of the first occurrence of the given character, starting the search at the specified index within the string.

Here is the code of the program:

public class IndexOfChar{
    public static void main(String args[]) {
    String s = "Honesty is the best Policy";
    System.out.println(s);
    System.out.println("indexOf(n, 1) -> " + s.indexOf('b'1));
    System.out.println("indexOf(n, 1) -> " + s.indexOf(981));
    }
  }

Output of the program:

C:\unique>java IndexOfChar
Honesty is the best Policy
indexOf(n, 1) -> 15
indexOf(n, 1) -> 15

C:\unique>

Download this example.

                         

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Latest Searches:
session handling in st
simple servlet program
CSV
program using iserror
@OneToMany in persiste
multiple radiobuttons
how can i add interger
swing package
ASP Ad Management CJ s
Combattons la programm
File Validation code
add the ArrayList to
hashset\
Jini's relevance emerg
breadcrumbs in jsp
how to pass same varia
string array add eleme
ODBC 2.5 and ODBC 3.0.
Date in JSP
create file jsp
javascript code in jsp
Java in Flex
depth first search of
ASP.NET .NET Inside AS
xmlwithjsp
jQuery to Select Multi
export access database
access mysql through c
struts.mapper.class
how many class is in h
Ã?Æ?Ã?Â¥Ã?â??Ã?­?Ã?Æ?
coding of windows medi
actionfrom validation
smallest palindrome ma
JFileChooser showOpen
jsp MENU SELECT MAKES
removing rows from Jta
create table with bina
prime numbers between
new function
jboss portal
Photoshop Drawing Drag
authorisation and auth
program in java to dis
Combattons la programm
validating form using
how to set text in a t
programs for Hibernate
java application code
removing all row from
how to remove panel an
dynamic array value
how we will use the ma
read hexadecimal numbe
Thread Sleep Method
jsp login by insertin
count row in resultset
count the number of di
C and Cpp Programming
how to generate word f
connect SQL server in
player applet j2me
tooltip message in tex
create a file in clien
AutoCAD Basics Using L
Combattons la programm
convert java.sql.Time
put string into a list
call ????????????????à
max length 500 chars
compress file uploadin
jsf combo box value fr
create a file in clien
reading image from htm
netbeans jsp jdbc
Apache JSP
convert string to stin
Swing component for en
not equals
Get Image
Java String toLowerCase Example
Java String toCharArray Example
Java String substring Example
Java String indexOf Example
Java String startsWith Example
Java String hashCode Example
Java String matches Example
Java String length Example
Java String lastIndexOf Example
Java String isEmpty Example
Java String equalsIgnoreCase Example
Java String equals Example
Java String endsWith Example
Java String copyValueOf Example
Java String contentEquals Example
  EAI Articles
  Java Certification
Tell A Friend
Your Friend Name
Search Tutorials

 

 
 
Browse all Java Tutorials
Java JSP Struts Servlets Hibernate XML
Ajax JDBC EJB MySQL JavaScript JSF
Maven2 Tutorial JEE5 Tutorial Java Threading Tutorial Photoshop Tutorials Linux Technology
Technology Revolutions Eclipse Spring Tutorial Bioinformatics Tutorials Tools SQL
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Indian Software Development Company | iPhone Development Company in India | Java Training Delhi | Java Training at Noida |

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2008. All rights reserved.