This week's book / license giveaways are in the JDBC and Relational Databases and Java in General forums.
We're giving away four copies each of PostGIS in Action and Java Advanced Topics Training and have the authors on-line!
See this thread and this one for details.
The moose likes Java in General and the fly likes help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Java » Java in General
Bookmark "help" Watch "help" New topic


parthiban subramaniam
Ranch Hand

Joined: May 15, 2002
Posts: 116
hello all,
been banging my head over this ,
would appreciate if anyone could help.

I have a string which is been encoded in base64 algorithm,
When I decode it I get something like this

String decoded = "PARTHIRU3 \u0000u\u0001_C \u0018\u0000C \u0018\u0000\u0000t�o\u0000u\u0001_\u0000\u0000\u0000\u000F\u0000\u0000\u0000\u000F\u0000\u0000\u0000\u000F\u0000\u0000\u0000\u000F\u0000t�o\u0000u\u0001_C\u0000t�o\u0000u\u0001_ \u0000t�o\u0000u\u0001_ C\u0000t�o\u0000u\u0001_\u0000\u0000\u0000\u000F\u0000\u0000\u0000\u000F\u0000\u0000\u0000\u000F\u0000\u0000\u0000\u000F\u0000u\u0001_\u0000\u0000\u0000\u000FSO\u0000t�o\u0000\u0000\u0000u\u0001_\u0018\u0000A01\u0000t�o\u0000u\u0001_\u0000u\u0001_D\u0000u\u0001_\u0000u\u0019�\u0000u\u0001_S\u0000t�o\u0000u\u0001_ \u0000t�o\u0000u\u0001_ \u0000t�o\u0000u\u0001_E\u0005\u0000u\u0001_\u0000t�o\u0000u\u0001_S\u0000u\u0001_ \u0018\u0000\u0018\u0000\u0000t�o\u0000u\u0001_\u0000\u0000\u0018\u0000\u0000u\u0001_\u0018\u0000\u0000t�o\u0000u\u0001_\u0018\u0000C\u0000\u0000\u0018\u0000\u0000\u0000\u0018\u0000 T\u0000u\u0001_";

As you can see this string has lot of escape literals all over the place,(a mix of null, trademark etc)

In midst of the whole thing I have to extract bits and pieces of data,

1, how do I remove all the escape from this string?

Sincerely appreciate your efforts

Best regards,

Even crazy and silly looking problems are sometimes real.
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24189

What do you mean by "remove" them? Do you want a much shorter string which doesn't include the nonprinting characters, or something else?

[Jess in Action][AskingGoodQuestions]
parthiban subramaniam
Ranch Hand

Joined: May 15, 2002
Posts: 116
i just want to strip out the non printable char's.
once they are removed they go in to bean,
for example

"PARTHIRU3" a part of that string will be split in to "PARTHI","R", "U3" etc

I agree. Here's the link:
subject: help