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



Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Hik
SubString help
1 Answer(s)      6 years and 9 months ago
Posted in : Java Beginners


Hi , I would appreciate if somebody could help me... a substring of 35 zeros '00000000000000000000000000000000000' and they could... substring . If it find 35 zeros i need 10 digits in front of it along with those 35


Advertisement
View Answers

April 23, 2008 at 8:19 PM


Hi friend,

import java.io.*;
import java.io.IOException;

public class FileReadExample {
public static void main(String args[]) throws IOException {
try{
BufferedReader buff = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Please enter file name");

String str = buff.readLine();
File file = new File(str);
FileInputStream fstream = new FileInputStream(file);
// Get the object of DataInputStream
DataInputStream in = new DataInputStream(fstream);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
String strLine;

//Read File Line By Line
while ((strLine = br.readLine()) != null) {
// Print the content on the console
System.out.println(strLine);
String subString = str.substring(0);
System.out.println("String after index: " + subString);
subString = str.substring(1,2);
System.out.println("Substring (1,2): " + subString);
}
//Close the input stream
in.close();
}
catch (Exception e){//Catch exception if any
System.err.println("Error: " + e.getMessage());
}
}
}

--------------------------



Related Tutorials/Questions & Answers:
help with substring in c programing
help with substring in c programing  Hi I could not found programming.... Please help with substring function,prompt the user for two strings and display whether or not the second string is a substring of the first string. Regards
SubString help - Java Beginners
SubString help  Hi , I would appreciate if somebody could help me... a substring of 35 zeros '00000000000000000000000000000000000' and they could... substring . If it find 35 zeros i need 10 digits in front of it along with those
Advertisements
Substring in java
Substring in java   example:output 0f the code.. Input String:University of the Cordilleras Input Substring:of Output:1 ...use non static methods,don't use (.Substring).. ..please help me.. ..thank you.. deadline:November
Substring in java
Substring in java   example:output 0f the code.. Input String:University of the Cordilleras Input Substring:of Output:1 ...use non static methods,don't use (.Substring).. ..please help me.. ..thank you.. deadline:November
find and substring
find and substring   **import java.io.BufferedReader; import... String"); String findstring = keybord.readLine(); String substring = keybord.readLine(); findreplace(findstring,substring); } catch(IOException io
C Programming SubString Program
C Programming SubString Program  Sir I want to Check whether the Single Substring is present in the given 3 string. characters. eg if i entered... will be TRUE. Plz Help Me
remove a substring from a string
remove a substring from a string  Please I jave an arraylist composed as follwoing [w1, w2, w3, w4, w1.w2.w3, w2.w3.w4, w3.w4, w2.w4, w1.w3, w1.w2... of w1.w2.w3 ?how I recognize it same for w1.w2 in w1.w2.w3. I nedd your help
check if a substring exists in a string
check if a substring exists in a string  Please I jave an arraylist composed as follwoing [w1, w2, w3, w4, w1.w2.w3, w2.w3.w4, w3.w4, w2.w4, w1.w3... your help. Thanks a lot
Java Substring
Java Substring In this section we will read about Java Substring. A part of String is called substring. Substrings are also a String. Substring is used..., how they can find the substring. To find the substring in Java there is method
How to substring in JQuery?
How to substring in JQuery?  Hi, I my JQuery application I am getting the value from server using Ajax. I have to substring the value in jQuery.... Please let's know How to substring in JQuery? Thanks   Hi
JavaScript indexOf substring
JavaScript indexOf substring...; In this section, we are going to find the location of substring using... the parameters substring is the specified string and 0 is the index
JavaScript substring length
JavaScript substring length...; This section illustrates you how to determine the length of substring in JavaScript. You... method substring() in order to extract the substring from  the defined
Search string using substring
Search string using substring  I want to print a string by searching a substring of that string. - i want to print email-ids from word files (resumes) in a directory. Search can be made using @ in the word file. So far i can
SubString in Java
SubString(), a method of String class is used to get a part of original string.... This method has two types: SubString(int beginIndex): This method returns part.... If beginIndex is equal to length in SubString(int beginIndex) it will return empty String
String substring method example
.style1 { font-size: medium; } String substring() method example:- In the Action Script3, substring are sequential characters that are found from a string. String class provide methods for finding substring from string. Method
C String Substring
C String Substring       In this section, you will learn how to get the substring from a string in C. You can see in the given example, a string and a method substring
JPA Substring() Function
JPA Substring() Function       In this section, you will learn about the JPQL substring() function. The substring() function returns the some part of string arguments
String substring(int beginIndex)
String substring(int beginIndex)   ... the substring(int beginIndex) method of String class. We are going to use substring(int beginIndex) method of String class in Java. The description of the code
find a substring by using I/O package
find a substring by using I/O package  Write a java program to find a sub string from given string by using I/O package
C get Substring from String
C get Substring from String       This section illustrates you how to get the substring using library function. You can see in the given example, we have used the library
String substring(int beginIndex, int endIndex)
String substring(int beginIndex, int endIndex)  ... 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
help
help   how i can send a pitcture on url in java
help
help  pls help me to get the code of a java program a program to perform different shapes in a menu using javaapplet
help
help  i need help with this code. write a java code for a method named addSevenToKthElement that takes an integer array, and an integer k as its arguments and returns the kth element plus 7. any help would be greatly
HELP
HELP  I need this code to open in a new web browser. but no matter what i do it wont please help?? Directive 055 Storage Requirements for the Upstream Petroleum Industry
Help...
Help...  Write a class that displays your first name vertically down the screen ?? where each letter uses up to 5 rows by 5 columns of a character input by you with a blank line between each letter
Help!
Help!  thanks for ur code, I'd like to ask a question: after press "c" or "C", timer starts and after every delay ms, it'll print "This line is printed only once." or just print once. I'm writting a timer but it seems to perform
Help
Help  Hi; Can anyone help me to solve this errors. I use J2ME(wirlesee Toolkit 2.5.2. for CLDC Project "SlideImageMIDlet" loaded Project settings saved Building "SlideImageMIDlet" C:\Documents and Settings\???? ?????\j2mewtk
help
to the user) please tell me how could i design that. Please help me asap Thanks a lot
 

 

 

DMCA.com