[2513] in java-interest
How to replace a char in String Object
daemon@ATHENA.MIT.EDU (Hui Zhao Wang)
Tue Oct 3 22:32:36 1995
Date: Tue, 3 Oct 1995 16:38:22 -0700 (PDT)
From: Hui Zhao Wang <huizhao@krypton.stanford.edu>
Reply-To: Hui Zhao Wang <huizhao@krypton.stanford.edu>
To: java-interest@java.sun.com
cc: huizhao@krypton.stanford.edu
Hi,
I am struggling to figure out how to replace a certain char by another, say,
I want to get rid of newline char from a String object. I tried:
str2 = str1.replace('\n', '\000');
The newline char is still in str2; then I tried:
str2 = str1.replace('\x0a', '\x00');
the compiler complains '\x0a', '\x00' they are invalid escape character.
I am not sure whether this is something to do with java char is 16bit or
not.
Sorry in advance if this is an answered question.
huizhao
-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com