开发者

Pasting a very long string in eclipse editor

开发者 https://www.devze.com 2023-03-09 06:57 出处:网络
I am trying to paste a very long string in eclipse like: String str = \"verrrrrrrrry long string that hass 9000 characters\";

I am trying to paste a very long string in eclipse like:

String str = "verrrrrrrrry long string that hass 9000 characters";

I want it to appear as
String str = "verrrrrrrrry long"+
             "string that hass "+
             "9000 characters";

I tried the option mentioned here : Paste a multi-line Java String in Eclipse , but that gi开发者_Python百科ves me a bunch of new lines inserted in the string which I dont want.

What I am getting currently is a long string that just wraps over itself on the same line.

Any pointers ?


Go in your Eclipse preferences:

under Java--> editor --> save actions --> Check off the "Format Srouce code" and "All Lines"

That will wrap it for you, when you save it.


You can make a macro on Notepad++ for instance and prepare the string there. After that you just need to paste it to Eclipse.


None of the settings worked for me , though they might be correct and I might have some other issue with my workspace.

Anyways, I was able to work through my problem with this expression:

cat Data.txt  | grep -o -E '.{1,70}' | sed -r 's/(.*)/        "\1"+/'

P.S: If anyone else confirms that one of the answers given by anyone in this post works, I will accept it on their behalf , since I think my answer is not a direct answer to my question.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号