visual studio - C# - Reading NewLine characters from reading a string character by character -
so have program loop, reading every character 1 one , replacing 4 digit number correlating particular letter using case statement.
my problem is not reading newline characters ('\n') , don't know how fix this.
here code:
(int = 0; < inputtextbox.text.length; i++) { //encryption switch (inputtextbox.text[i]) { // got rid of rest of cases // not relevant case '\n': encryptedstring = encryptedstring + "8024"; break; } }
and since not accept new line character, doesn't add encryptedstring.
this might seem duplicate question other posts found in different situations.
edit ---------------------------------------------------------------------------------------------------------------------------- after debugging, turns out reading '\n' not writing string when decoding it.
here's code decoding section:
(int = 0; < readstring.length; = + 4) { //decryption switch (readstring.substring(i, 4)) { case "8024": decryptedstring = decryptedstring + "\n"; break; } } inputtextbox.text = decryptedstring;
so reaching "decryptedstring = decryptedstring + "\n";" line not adding new line string reason. have tried '\n' instead of "\n" sure.
i replaced "\n" when decoding newlines "system.environment.newline" , fixed problem.
Comments
Post a Comment