This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes JavaScript/Java Equivalent function? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply 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://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: JavaScript/Java Equivalent function?
 
Similar Threads
Dropping leading zeros on numeric field
in java where is clrscr() function
Clrscr() Equivalent function Java
JavaScript/java equivalent function?
what's the command equivalent to getch()