在 Eclipse 中,如何用新行替换字符?

发布于 2024-07-05 18:32:52 字数 133 浏览 9 评论 0原文

在 Eclipse 3.3.2 中,我想用文件中的新行替换字符(例如“,”)。 为了做到这一点,我应该在“替换为”框中写什么?

编辑:许多答案似乎适用于 Eclipse 3.4。 Eclipse 3.3.X 有解决方案吗?

In Eclipse 3.3.2, I would like to replace a character (say ',') by a new line in a file.
What should I write in the "Replace with" box in order to do so ?

EDIT : Many answers seems to be for Eclipse 3.4. Is there a solution for Eclipse 3.3.X ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

孤单情人 2024-07-12 18:32:52

选中“正则表达式”复选框并在“替换为”框中使用“\R”。

这是 Eclipse 3.4 中引入的新功能,请参阅 3.4 中的新增功能

Check box 'Regular Expressions' and use '\R' in the 'Replace with' box

It's a new feature introduced with Eclipse 3.4, See What's New in 3.4

路弥 2024-07-12 18:32:52

选中“正则表达式”框并在“替换为”框中使用“\n”

Check box 'Regular Expressions' and use '\n' in the 'Replace with' box

温柔少女心 2024-07-12 18:32:52

就像其他人所说的那样,只需使用正则表达式,但不要只是 \r,而是 \r\n

Like the others said, just use regular expression, but instead of just \r, put \r\n

梦过后 2024-07-12 18:32:52

如果在选中“正则表达式”复选框的情况下执行文件搜索,则替换全部/替换所选内容也将允许正则表达式,并将 \n 转换为文件中的换行符

if the file search is performed with Regular Expressions checkbox checked, then replace all / replace selected will also allow regular expression and will transform \n to a newline in the file(s)

阳光①夏 2024-07-12 18:32:52

我正在使用 Helios 并且它可以工作,但是我在替换时遇到了一些问题...我想在这些括号“><”之间放置一个换行符 (为了使每个新的 XML 标记转到新行)...首先,我必须在 2 个括号之间放置一个字符,例如 /r,之后我选中“正则表达式”框并将 /r 替换为 \ R,这导致了正确的换行符。 否则,替换似乎是灰色的。

I'm using Helios and it works, however I had some issues with replacement... I wanted to place a line break between any of these brackets "><" (to make each new XML tag go to a new line)... first I had to place a chacter between the 2 brackets, for instance /r, after this i checked the "regular expressions" box and replaced the /r with \R, which resulted in the correct linebreak. otherwise, the replace seemed to be greyed out.

怼怹恏 2024-07-12 18:32:52

我刚刚找到了一篇关于该内容的文章问题。 这似乎是一个错误。

有一个解决方法是在剪贴板中复制新行,然后将其粘贴到“替换”框中。

I've just found an article about that problem. It seems to be a bug.

There's a workaround which is to copy a new line in clipboard and then paste it inside the "replace" box.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文