hi this is my file contents
#nadal\r\n#federer\r\n*#djokovic\r\n#murray\r\n
i want to use \n as delimiter i want my output as
#nadal\r
#federer\r
*#djokovic\r
#murray\r
i googled about it but i could not find answer
here is my code written in java
Scanner scan=null;
scan = new Scanner(new FileReader("//Users//Rakesh//Desktop//input.txt"));
// initialize the string delimiter
scan.useDelimiter(Pattern.compile("[\\r\\n;]+"));
// Printing the delimiter used
System.out.println("The delimiter use is "+scan.delimiter());
// Printing the tokenized Stringhashtable
while(scan.hasNext()){
System.out.println(scan.next());
}
// closing the scanner stream
scan.close();
i am getting output as whole line instead of in new line.Can any one help on this TIA