The text file contains the following data. I wish to remove the '$' from each row of the text file. I also wish to store the Name,Drink and Cost in variables for future manipulation. However, that can be performed later. I do not understand what is wrong with my code, Here is the Textfile Data:
Problem solved using Regex escape pattern. I had to replace the "$" with "\s*\$\s*"
Rubin$Vodka$55
Alex$Gin$22
Max$Water$FREE
Code:
  File filename = new File("animals2.txt");        
        try{
        Scanner sc = new Scanner(filename);
        String line = sc.nextLine();
        Scanner linesc = new Scanner(line).useDelimiter("$");
        while(linesc.hasNext()){
            String name = linesc.next();
            txaDisplay.append(name + "\n");
        }
    }
    catch(Exception e){
                    e.printStackTrace();
    }
 
     
     
     
     
     
     
    