I would like to know how I can convert standard input to a string. For instance, I have a txt file with n amount of letters – all these I want to read into one string.
Just to make sure: standard input is when you give the program a .txt as input.
Help would be appreciated!
This can be done using
commons-io:(complete example)
To read from stdin to a string, you could use a scanner. Use
while (scanner.hasNextLine())if you want the entire file.