java - Replacing newline character in UNIX -


I am making a code to replace a newline character with a string. In Windows, when I use

  string.resales (all. System.getProperty ("line.separator"), "\\ n");   

This works fine, but it fails in Unix.

What should I use in Unix?

\ n is true for Unix Windows \ r \ N uses and uses the mac \ r \ / code> IIRC.

The problem may be that Java is a multilingual language, automatically replaces \ n with the system's separator, I do not know Java but I think that it is a matter.

EDIT: If the code you posted is what you are using, then I think I'm seeing the problem. string is a class. It is also irreversible in Java, it should be instead:

  string myStr = "abc \ ndef"; MyStr = myStr.replaceAll (/ * params * /);    

Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -