简体   繁体   English

当我将代码从oneNote复制到Eclipse时,正确的代码用红色蠕动的行标记,并给出语法错误

[英]When I copy code from oneNote to Eclipse, correct code is marked with red squiggly line and gives syntax error

图片

I tried copying the text first to notepad and then pasting it from there to get rid of possible text formatting. 我尝试先将文本复制到记事本,然后从那里粘贴以摆脱可能的文本格式。 But still didn't work. 但是还是没用。

However, when I copy the code to the google search bar and then paste it back to Eclipse it worked. 但是,当我将代码复制到google搜索栏,然后将其粘贴回Eclipse时,它可以工作。

Can someone tell me why this happens? 有人可以告诉我为什么会这样吗? Is there an easier way to prevent having these syntax errors when copying text from oneNote? 从oneNote复制文本时,是否有更简单的方法来防止出现这些语法错误?

    public static void isPalidrome(String str) {
            if (str.charAt(0) != str.charAt(str.length() - 1)) {
                    System.out.println("Not a palidrome");
                }

            else if (str.length() <= 2) {
                    System.out.println("Is a palidrome");
                }

            else {
                    isPalidrome(str.substring(1, str.length() - 2));
                }
    }

}

OneNote is very bad for keeping programming code. OneNote对于保留编程代码非常不利。 It inserts non-breaking space into your code. 它将不间断的空格插入代码中。 It's not visible but always causes errors when you copy it out of OneNote. 它不可见,但是将其复制到OneNote中时总是会导致错误。

Vote this OneNote feedback to get them look into the problem: Uservoice 投票此OneNote反馈以使他们调查问题: Uservoice

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM