How do I switch between Windows and UNIX newlines

2019-02-05 20:10发布

The version of NetBeans that I use is 6.5.1

9条回答
做自己的国王
2楼-- · 2019-02-05 20:44

recently updated to 7.2 and started to search for the solution I had at 7.1.2 version. Take a look at this plugin that helps to switch between line endings types.

查看更多
Luminary・发光体
3楼-- · 2019-02-05 20:44

I think you can't. NB will use the native OS format where it is running. If you have issues with that, there is an Ant FixCRLF task.

查看更多
小情绪 Triste *
4楼-- · 2019-02-05 20:50

There is a platform specific property that you may use make your code cross platform. See http://java.sun.com/docs/books/tutorial/deployment/applet/properties.html

String newline = System.getProperty("line.separator");

查看更多
孤傲高冷的网名
5楼-- · 2019-02-05 20:51

What is your goal - to have a work flow using only Unix line-endings?

As has already been pointed out - there isn't any functionality in Netbeans to convert from one line ending to the other.

New PHP files created in NetBeans (File > New File > PHP) have Unix line endings by default.

This doesn't really give you the functionality you asked about but Netbeans will respect the file endings of existing files and create new PHP files with Unix line endings.

查看更多
萌系小妹纸
6楼-- · 2019-02-05 20:54

I don't know how to do this using NetBeans, but if you store your code in a Subversion repository, you might want to look into the svn property svn:eol-style.

查看更多
Animai°情兽
7楼-- · 2019-02-05 20:55

There is a plugin that will help to switch the line endings. It is 'Show and change line endings'. You can install it directly within NetBeans.

Go to Tools->Plugins->Available Plugins
Then search for it. Check the checkbox and press 'Install' button.

查看更多
登录 后发表回答