i was doing a small java code where data is read through a file and stored in a String
and then using subStrig i have to break this string ,
For example data is saved like this "Hello java $" "Hello word $" , each sentence contains $ at the end and i want to break it on the basis of $
I did try using indexOf , lastindexOf etc but was not able to do exact logic , pleas help me
BufferedReader br= new BufferedReader(new FileReader("c:\\javaprograms\\a.txt));
while((a=br.readLine())!=null)
{
s=s+a;
// here i have to split the data that is "Hello java$" "Hello world$"
}
Maybe it would be better to use a Scanner with custom delimiter?
For example like this:
This code splits your text with “$” as delimiter