File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes JavaScript/Java Equivalent function? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "JavaScript/Java Equivalent function?" Watch "JavaScript/Java Equivalent function?" New topic
Author

JavaScript/Java Equivalent function?

Ravi Mandalapu
Ranch Hand

Joined: Nov 01, 2000
Posts: 34
Hi,
Is there any equivalent javascript's escape() function in java?
I want to hex-encode in java, that's why i need that function.
Any help would be greatly appeciate.
Thankx,
Ravi
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
Well I am not JavaScript expert. What exactly does the escape() do? If you mean an escape character, that is the \ in Java. So \" forces a literal double quote.
If you are just trying to work with hex in java then prefacing the hex value with 0x makes it hex.
0x12 = 18 dec


"JavaRanch, where the deer and the Certified play" - David O'Meara
Ravi Mandalapu
Ranch Hand

Joined: Nov 01, 2000
Posts: 34
Hi Cindy,
Thank you very much for your response.
My problem is, I have to invoke the NetscapeMessenger at client side and i have to pass the form data to Netscape messenger fields like CC,TO,BODY,.... for this reason i used MAILTO:// approach.
Suppose if i pass multible lines to Messenger body field,it is displaying total data in single line, suppose if we use javascript escape() function, it will convert newlinecharacters,spaces,.....into hex code and pass that data to Messenger.
I want the same functionality using java,is it possible?
Thankx in advanch.
Reply will be greatly appreciate.
ravi
Originally posted by Cindy Glass:
Well I am not JavaScript expert. What exactly does the escape() do? If you mean an escape character, that is the \ in Java. So \" forces a literal double quote.
If you are just trying to work with hex in java then prefacing the hex value with 0x makes it hex.
0x12 = 18 dec

michelle cheung
Greenhorn

Joined: Jun 05, 2001
Posts: 11
There's a class in java.net
URLEncoder.encode( myString );
That will do the same thing as escape in javascript
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JavaScript/Java Equivalent function?