Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Java String-examples Java String Examples

Related Tutorials


 
 

Share on Google+Share on Google+

Java String Examples

Advertisement
Comparing Strings (== operator) This section describes how two string references are compared. If two String variables point to the same object then these two variables are called references for the same object.

Java String Examples

     

  1. Comparing Strings (== operator)
    This section describes how two string references are compared. If two String variables point to the same object then these two variables are called references for the same object.

  2. Creation of StringBuffer
    In this section, you will learn how to create a string buffer. Here we have used the following StringBuffer Constructors.
      
  3. Reading File into a Byte Array
    In this section, you will learn how to make a file to be read into a byte array. Here we have used inputStream constructor to take file as a parameter.
     
  4. Java Count Vowels
    In this program you will learn how to count vowels in a String. Here you will be asked to enter a String of your own choice and then you will get the number of vowels from that String.

  5. Java Display File-Extension
    In this program you will learn how to display the file extension of the file. Here you will be asked to enter the file name and then you will get the extension of the file.

  6. Java Change File-Extension 
    In this program you will learn how to change the file extension of the file. Here you will be asked to enter the file name whose extension is to be changed and then you will get the file name with the changed extension.

  7. Java String Occurrence in a String
    In this program you will learn how to find the occurrence of a String in another String. Here we have already taken a String.

  8. String replaceFirst() Method
    In this program you will learn how to replace words in a text. We are going to use replaceFirst() method of String class in Java. The description of the code is given below for the usage of the method.

  9. String indexOf() Method
    In this section, you will get the detailed explanation about the indexOf() method of String class. We are going to use indexOf() method of String class in Java. 

  10. String sort() Method
    In this program you will learn how to sort words in a String. The sorting will be done in ascending order.
    We are going to use sort() method of String class in Java. The description of the code is given below for the usage of the method.

  11. String replaceAll() Method
    In this program you will learn how to replace all the words in a String.
    We are going to use replaceAll() method of String class in Java. The description of the code is given below for the usage of the method.

  12. String indexOf(int ch) 
    In this section, you will get the detailed explanation about the indexOf(int ch) method of String class. We are going to use indexOf(int ch) method of String class in Java. 

  13. 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. 

  14. String indexOf(String str) 
    In this section, you will get the detailed explanation about the
    indexOf(String str) method of String class. We are going to use indexOf(String str) method of String class in Java.

  15. String indexOf(String str, int fromIndex) 
    In this section, you will get the detailed explanation about the
    indexOf(String str, int fromIndex) method of String class. We are going to use indexOf(String str, int fromIndex) method of String class in Java.

  16. String lastIndexOf(int ch)
    In this section, you will get the detailed explanation about the lastIndexOf(int ch) method of String class. We are going to use lastIndexOf(int ch) method of String class in Java.

  17. String lastIndexOf(String str) 
    In this section, you will get the detailed explanation about the
    lastIndexOf(String str) method of String class. We are going to use lastIndexOf(String str) method of String class in Java. 

  18. String lastIndexOf(String str, int fromIndex)
    In this section, you will get the detailed explanation about the lastindexOf(String str, int fromIndex) method of String class. We are going to use lastindexOf(String str, int fromIndex) method of String class in Java.  

  19. String lastIndexOf(int ch, int fromIndex)
    In this section, you will get the detailed explanation about the lastindexOf(int ch, int fromIndex) method of String class. We are going to use lastindexOf(int ch, int fromIndex) method of String class in Java.

  20. String regionMatches()
    In this section, you will get the detailed explanation about the regionMatches() method of String class. We are going to use regionMatches() method of String class in Java.

  21. String substring(int beginIndex)
    In this section, you will get the detailed explanation about the substring(int beginIndex) method of String class. We are going to use substring(int beginIndex) method of String class in Java.

  22. String substring(int beginIndex, int endIndex)
    In this section, you will get the detailed explanation about the substring(int beginIndex, int endIndex) method of String class. We are going to use substring(int beginIndex, int endIndex) method of String class in Java.

  23. String equalsIgnoreCase(String Str)
    In this section, you will get the detailed explanation about the equalsIgnoreCase(String Str) method of String class. We are going to use equalsIgnoreCase(String Str) method of String class in Java. 

  24. String Concat()
    In this section, you will get the detailed explanation about the
    Concat() method of String class. We are going to use Concat() method of String class in Java.

  25. String copyValueOf(char[] data, int offset, int count)
    In this section, you will get the detailed explanation about the copyValueOf(char[] data, int offset, int count) method of String class. We are going to use copyValueOf(char[] data, int offset, int count) method of String class in Java. 

  26. String getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin)
    In this section, you will get the detailed explanation about the getChars() method of String class. We are going to use getChars() method of String class in Java. 

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

  28. String Determining a Character's Unicode Block
    In this section, you will get the detailed explanation about the UnicodeBlock() method of String class. We are going to use UnicodeBlock() method of String class in Java. The description of the code is given below for the usage of the method.

 

Advertisement

If you enjoyed this post then why not add us on Google+? Add us to your Circles



Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: February 27, 2008

Related Tutorials

Discuss: Java String Examples  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:9
Rahul Kumar
July 5, 2011
String

Nice methods detail of string in java
ruchi
August 28, 2011
java program

please give me answer of give questions... (1) A java program that capitalizes the first letter of the sentence and makes all other letters lowercase. Also add a period at the end. Display the result. (2) A Java program to delete all vowels from the string and display the result. (3) A Java program to remove all spaces from a sentence and display the result.
nikesh
October 16, 2011
java

it is very critical
vijayabaskar
February 27, 2012
Java Question

Dear Sir, Good Day I Need one answer in my question. plz help me 1. When is String(Char ACI) used? Thanks and Regards, k.vijayabaskar.
teja
June 4, 2012
java

needs clear explanation regarding program wrting
siva
August 4, 2012
java

hi
teju
August 9, 2012
hi................

simple programs for all the string methods
K.Sunanda
August 30, 2012
aptitude

this passage very useful to me.
k.kumar
August 30, 2012
aptitude

intresting for me this topic
DMCA.com