Accessing txt data in wanted order
in
Programming Questions
•
1 month ago
Hello,
I am working with strings in a txt file.
The code is simple:
- String [] stopWords;
- void setup() {
- stopWords = loadStrings("stopwords.txt");
- for (String stopWord : stopWords) {
- println(stopWord);
- }
- }
I get: a,able,about,across,after,all,almost,also,am...
The txt file data is written in one line: a,able,about,across,after,all,almost,also,am...
How to write data in a txt file to get the output of "println(stopWord)" not in a line, but in a list (without changing the processing code):
a,
able,
about,
across,
....
The reason why I asking this, is I have a code which check the every word from another list and compares with "stopWord" string list:
- boolean isStopWord(String word){
- for(String stopWord : stopWords){
- println(stopWord);
- if(word.equals(stopWord)){
- return true;
- }//if
- }//for
- return false;
- }//isStopWord()
1