Originally Posted By: dtangster
While trying to do the Quine assignment I ran into a problem.
When I create a very large array of strings that contain my own code, I sometimes have to escape characters with a '\'. For example, when I need to add double quotes to my array of strings, I have to escape it. Now this causes a problem because when I print out the Quine, everything is correct EXCEPT for the lines that used escape characters because it doesn't show the extra '\'.
For example, an actual line of code in my program is:
System.out.println(self[STR_INDEX] + "\"" + self[i] + "\"" + ',');
For the array of strings that represent my code, one of the elements is this:
"System.out.println(self[STR_INDEX] + \"\\\"\" + self[i] + \"\\\"\" + ',');"
The problem now is that when I print this element back, it shows the element as being:
System.out.println(self[STR_INDEX] + "\"" + self[i] + "\"" + ',');
which is not the correct way I wrote it within the array of strings. I can't seem to get around this problem.
'''Originally Posted By: dtangster'''
While trying to do the Quine assignment I ran into a problem.<br><br>When I create a very large array of strings that contain my own code, I sometimes have to escape characters with a '\'. For example, when I need to add double quotes to my array of strings, I have to escape it. Now this causes a problem because when I print out the Quine, everything is correct EXCEPT for the lines that used escape characters because it doesn't show the extra '\'.<br><br>For example, an actual line of code in my program is: <br><br>System.out.println(self[STR_INDEX] + "\"" + self[i] + "\"" + ',');<br><br>For the array of strings that represent my code, one of the elements is this: <br><br>"System.out.println(self[STR_INDEX] + \"\\\"\" + self[i] + \"\\\"\" + ',');"<br><br>The problem now is that when I print this element back, it shows the element as being:<br><br>System.out.println(self[STR_INDEX] + "\"" + self[i] + "\"" + ',');<br><br>which is not the correct way I wrote it within the array of strings. I can't seem to get around this problem.