Originally Posted by
rajesh.mv
yes Exactly(Is there any methods to find out the postion of the string without splitting ).if you know any solution just give me reply
You mean like this then? For the purpose of this code the Strings are in a file called pipefile.txt
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.InputStreamReader;
public class Pipe {
/**
* JavaProgrammingForums.com
*/
public static int position;
public void readFile(){
try
{
FileInputStream in = new FileInputStream("pipefile.txt");
BufferedReader br = new BufferedReader(new InputStreamReader(in));
String strLine;
while((strLine = br.readLine())!= null)
{
System.out.println(strLine);
position = strLine.indexOf("required");
System.out.println("'required' at position " + position);
}
}catch(Exception e){
System.out.println(e);
}
}
public static void main(String[] args) {
Pipe p = new Pipe();
p.readFile();
}
}
Example output:
java|21|new1|kkkk|eee|rrrr||dddd|dddd|ooooo|2073|| ||||7747474|48888|required||||444444|.
'required' at position 69
java|22|new2|kkkk|eee|rrrr||dddd|dddd|ooooo|2073|g gggg||rrrrrrrr||5555555|7747474|48888|required|||| 444444|.
'required' at position 89