This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I am getting a String from a TextArea. Ascii 10 and 9 convert to blocks . I want to convert these blocks to the unicode linefeed and tab, put cannot. How would I replace these blocks with the proper unicode characters. I am using 1.3, and cannot change. Thanks
In 1.3 you don't get String.replace() but you can write your own using indexOf() and substring() to find the delimiters and break up the bits. Here's part of one I did in my first J++ project:
Ouch, this is pretty bad! See if you can make it a lot better by keeping the output separate from the input. This also loops until the heap explodes if "new" contains "old", eg replace "BERT" by "ROBERT".
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
the above snippet replaces the '[' character. you can customise it accordingly to replace whichever character you want.
Life called,so here I am.<br />Cheers<br />Niki.:-)
Joined: Mar 13, 2004
Thanks. I can replace the block, but the Unicode character comes out as a block too. I converted to a byte array and the value is 10, but it still comes out as a block in the String. Is this a problem with 1.2, 1.3? I use \n and other unicode values to replace what is in there.