Join
Blogs
Questions
Videos
Tags
Members
Search
 
 
Create your own blog, earn points and get popular!

String

Lolmewn's picture

Getting all strings from a file

Basically, I am working on a Java Program which will take all items from a file, and do stuff with it. What I need, is something which will get all the Strings from the = signs in a file.
A file looks like this:
string1=57;2
string2=208;4
string3=146;4
string4=78;3
4
Your rating: None Average: 4 (1 vote)
Rahul's picture

Java String to ArrayList

3.5
Your rating: None Average: 3.5 (4 votes)
This Java example shows how to convert Java String to ArrayList object.
  1. import java.util.ArrayList;
  2.  
  3. //Java String to ArrayList
  4.  
  5. public class StringToArrayList {
  6.  
  7.     public static void main(String args[]){
  8.        
  9.         //original string containing numbers
  10.         String strNumbers = "One Two Three Four Five";
  11.        
  12.         //split the string using split method of
Rahul's picture

Java String array to ArrayList

0
Your rating: None
This Java example shows how to convert Java String array to ArrayList object.
  1. import java.util.ArrayList;
  2. import java.util.Arrays;
  3.  
  4.  
  5. //Java String array to ArrayList
  6. public class StringArrayToArrayList {
  7.  
  8.     public static void main(String args[]){
  9.        
  10.         String[] strColors = new String[]{"Red", "Green", "Blue"};
  11.        
  12.         /*
  13.        
Andr's picture

Java String indexOf Example

4
Your rating: None Average: 4 (5 votes)
  1. /*
  2. Java String indexOf example.
  3. This Java String indexOf example describes how Java String indexOf method is used to
  4. find particular character or string within given string object.
  5. */
  6.  
  7.  
  8. public class JavaStringIndexOfExample{
  9.  
  10.  
  11. public static void main(String args[]){
  12.  
  13.  
  14. /*
  15. Java String class defines following couple of indexOf methods to
  16. search character or string within the g
Rewati's picture

Java Vector to String

How do I convert vector to string? I have a vector in which I store value entered by user. I want to get the value from vector and convert it back to String object.
0
Your rating: None
Andr's picture

String Length, String Changing Case, String Intern, Java String Tutorial

5
Your rating: None Average: 5 (1 vote)
String Manipulation Part 3

6.) Manipulating Character Case

String class provides following methods to manipulate character case in String.

String toUpperCase()
String toUpperCase(Locale locale)

String toLowerCase()
String toLowerCase(Locale locale)
Andr's picture

Substring, Replace Characters From String, String Conversion, Java String Tutorial

0
Your rating: None
String Manipulation - Part 2

3.) Replacing characters in String

The replace method of String can be used to replace all occurrences of the specified character with given character.

String replace(char oldChar, int newchar)


4.) Getting substrings
Andr's picture

Java Search String, Reading Character From String, Java String Tutorial

0
Your rating: None
String Manipulation

1.) Reading characters from String:

char charAt(index i)

Returns char at specified index. An index ranges from 0 to length() -1.

2.) Searching characters in String
Andr's picture

String Equality, Compare Java Strings

0
Your rating: None
String equality - Compare Java String

String class overrides the equals() method of the Object class. It compares the content of the two string object and returns the boolean value accordingly.

For example,

String str1="Hello";
String str2="Hello";
Andr's picture

String Constructors

0
Your rating: None
String Constructors

String class provides various types of constructors to create String objects. Some of them are,

String()
Creates a new String object whose content is empty i.e. "".
Syndicate content