score:423
Okay, I just found the answer (on Stackoverflow, no less).
Eclipse has an option so that copy-paste of multi-line text into String literals will result in quoted newlines:
Preferences/Java/Editor/Typing/ "Escape text when pasting into a string literal"
score:-9
As far as i know this seems out of scope of an IDE. Copyin ,you can copy the string and then try to format it using ctrl+shift+ F Most often these multiline strings are not used hard coded,rather they shall be used from property or xml files.which can be edited at later point of time without the need for code change
score:0
The EclipsePasteAsJavaString plug-in allows you to insert text as a Java string by Ctrl + Shift + V
Example
Paste as usual via Ctrl+V:
some text with tabs
and new
lines
Paste as Java string via Ctrl+Shift+V
"some text\twith tabs\r\n" +
"and new \r\n" +
"lines"
score:3
See: Multiple-line-syntax
It also support variables in multiline string, for example:
String name="zzg";
String lines = ""/**~!{
SELECT *
FROM user
WHERE name="$name"
}*/;
System.out.println(lines);
Output:
SELECT *
FROM user
WHERE name="zzg"
score:4
If your building that SQL in a tool like TOAD or other SQL oriented IDE they often have copy markup to the clipboard. For example, TOAD has a CTRL+M which takes the SQL in your editor and does exactly what you have in your code above. It also covers the reverse... when your grabbing a formatted string out of your Java and want to execute it in TOAD. Pasting the SQL back into TOAD and perform a CTRL+P to remove the multi-line quotes.
score:11
You can use this Eclipse Plugin: http://marketplace.eclipse.org/node/491839#.UIlr8ZDwCUm This is a multi-line string editor popup. Place your caret in a string literal press ctrl-shift-alt-m and paste your text.
Source: stackoverflow.com
Related Query
- Paste a multi-line Java String in Eclipse
- Build Eclipse Java Project from Command Line
- Wrapping chained method calls on a separate line in Eclipse for Java
- Java "constant string too long" compile error. Only happens using Ant, not when using Eclipse
- Java - Build and run eclipse project from command line
- Vertical line between matching curly braces for java in eclipse
- How can I set the current line of execution in the eclipse java debugger?
- How to know the command line used by Eclipse to run the java program?
- Highlighting all occurrences of a search string in Eclipse Java editor
- How to use different line wrapping for strings and other items in Eclipse for Java
- Copy and paste in Eclipse adds window newlines at the end of each pasted line
- Eclipse Command Line Java
- EclEmma Line Number Output Java Eclipse Plugin
- Organize imports of java files using eclipse from command line
- How do I determine the command string eclipse uses to launch my java program?
- Is it possible to change the colour of a line of text in Eclipse Java Editor based on it's content?
- Eclipse command line formatting of Java code
- Java classes get compiled via external maven inside eclipse but not (with same maven) from command line
- Eclipse string literal line wrapping
- Java eclipse String Error
- Can't run Java Application with Maven from Eclipse but it works in Command line
- Command line for Eclipse Java formatter
- Eclipse multi editor window copy + paste + undo + redo + delete
- Invoke eclipse Java save actions from command line
- How to add a line in all java files in eclipse
- Java generics code compiles in eclipse but not in command line
- Running a Java program in Eclipse as if from command line
- Formatting Java enums using one line for every enum value with Eclipse
- eclipse java code style formatter: prevent line wrapping for the special cases
- Java eclipse IDE line speed debug
More Query from same tag
- What should I use for coding C++ on a Mac and Windows?
- How to use Eclipse Mars to connect to Subversion
- How do EGit versions map to Git versions
- How Eclipse know I didn't call some method of a object?
- Runtime Exception unable to start MainActivity
- Eclipse: Unable to detect device compatibility
- "Cannot execute binary file: Exec format error" x84-64 bit program running on aarch64 processor Debian 10
- Eclipse - Improve performance and RAM usage
- How to debug a python script launched by a third party app
- Java build path, differences between Library tab and Order And Export Tab
- prevent eclipse from cleaning up generated files
- Eclipse keep saying "No tests found with test runner JUnit 5"
- Open Run Configuration... dialog in a eclipse application
- How do I suppress warnings in Eclipse for PHP?
- KSoap-Android causing Conversion to Dalvik format failed with error 1
- How to automatically set environment variable for eclipse terminal view?
- Eclipse JAR creation vs. cmd line JAR creation
- Deploy GWT maven project with eclipse deploys webapp directory instead of target/project directory
- Customize eclipse taskbar
- How to import RESTful Server Hapi Fhir?
- A few stupid questions about Eclipse
- Is it possible to show the path of eclipse.exe in the Title?
- How do I increase the memory limit for my GWT app in dev mode?
- Xtext Multiple DSL cross referencing: How to retrieve correct proxy-resolved resourceset
- git clone modifying eclipse C/C++ project include paths
- Eclipse outline view does not display a sort icon
- Is eclipse 3.6 compatible for google apps?
- Eclipse error create android app:Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'
- Eclipse Memory usuage in Windows Vs Linux
- How to get a list of child nodes and iterate over them