-5
        [![While executing a command i am getting output with "" how can I supress those symbol in my output][1]][1]


          [1]: https://i.stack.imgur.com/UgZDI.png


//OutputStream out = channel.getOutputStream();
                out.write(3); // send CTRL-C
                out.flush();
                System.out.println("exit1");
                if (expect.expect("$") > -1) {
                    System.out.println("finding $");

                    contt = (expect.before);
                    if (contt != null && contt != "") {
                       output=contt.replaceAll("", " ");
                        System.out.println("afterline"+output);


                    } else {
                        contt="Error in Top Check";
                        System.out.println("Error in Top check");
                    }
//I am trying to replaceAll this string.

//I am running command though jsch and getting the following output which i have shared as screenshot.I need to display itby removing the" " from the output. Need help in it

riza
  • 123
  • 2
  • 11
  • 2
    What have you tried so far? (Hint: String.replace(), Character.isISOControl(c) ) – Jan May 30 '17 at 11:42
  • i have tried using repalce All.no psoitive result – riza May 30 '17 at 11:47
  • 2
    SHOW us the code of what you've tried - that would improve your question a lot and would show efforts on your part - so we don't point into things you've already tried. (the "EDIT" button is your friend!) – Jan May 30 '17 at 11:48
  • Try to improve your questions, or nobody will be able to help you. – DMC19 May 30 '17 at 11:55
  • I think you are having some troubles with the replaceAll and the quotes. Check this: https://stackoverflow.com/questions/3559063/how-to-enter-quotes-in-a-java-string – DMC19 May 30 '17 at 12:01
  • output=contt.replaceAll("", " "); -> Replace nothing with something? Do you know that replaceAll needs a regex to work? You may want to take your response and iterate through all characters to see which ones are displayed bad – Jan May 30 '17 at 12:01
  • I am not being a dumbass to replace "" with "". The "/" is not being shown up here.Thats y i was trying atttach a screenshot – riza May 30 '17 at 12:10
  • Possible duplicate of [remove all special characters in java](https://stackoverflow.com/questions/14361556/remove-all-special-characters-in-java) – Zallentine May 30 '17 at 12:25

1 Answers1

1

Two plausible solutions:

1) Using standard replaceAll() method of String Class, eg :

String a = a.replaceAll("\"","");

2) Using Apache StringUtils replace method eg :

String a = StringUtils.replace(a,"\"",""");
Rothin Sen
  • 444
  • 4
  • 8
  • it's not really " that's the problem but some unprintable characters in response – Jan May 30 '17 at 12:03