editing a string using BufferedReader in Java

Posted by pbs on Stack Overflow See other posts from Stack Overflow or by pbs
Published on 2012-06-08T22:37:30Z Indexed on 2012/06/08 22:40 UTC
Read the original article Hit count: 164

Filed under:

Exception handling aside, I'm using the following to input a line of text in Java:

BufferedReader strin = new BufferedReader(new InputStreamReader(System.in));
String txt = null;
txt = strin.readLine();

However, I want to be able to edit an existing string, so that if txt were initialized to "hello" instead of null, then the readLine() would have the "hello" text in the buffer for me to edit.

I can't see how to do this. Any help would be appreciated.

© Stack Overflow or respective owner

Related posts about java