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
Post a Comment