'How can I save two strings in a single-line .txt file to their corresponding variables?
I have a .txt file that has a single line of: "abc xyz"
abc is supposed to represent a prefix string and xyz is to represent forbidden characters. The code I have so far is:
File fileTwo = new File("\"C:\\Users\\Natec\\Downloads\\LSU CSC Projects\\3102Proj3\\inputFile.txt\"");
FileInputStream FITwo = new FileInputStream(fileTwo);
byte[] byteArrayTwo = new byte[(int)fileTwo.length()];
FI.read(byteArrayTwo);
String dataTwo = new String(byteArrayTwo);
How do I use what I have read in this file to assign abc to a variable of "String prefix" and xyz to a variable of "String forbidden?"
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|