You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Yan, Charlene" <Ch...@thomsonlearning.com> on 2003/07/22 21:26:16 UTC

[OT]Java equivalent to ASP function

All,

I need to rewrite some ASP codes in Java.  What are the Java equivalent to Asc(String) and Hex(Number) in VB?  I appreciate any insight from you!

Thanks.

Charlene

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: [OT]Java equivalent to ASP function

Posted by Erik Price <ep...@ptc.com>.

Yan, Charlene wrote:
> All,
> 
> I need to rewrite some ASP codes in Java.  What are the Java equivalent to Asc(String) and Hex(Number) in VB?  I appreciate any insight from you!


I don't know VB.  I assume Hex(Number) transforms the number to 
hexadecimal.  You can get the hexadecimal representation of a binary 
number like so:

int x = 4;
String hexOf4 = Integer.toHexString(x); // becomes "0x4"

What does Asc(String) do?



Erik


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: [OT]Java equivalent to ASP function

Posted by atta-ur rehman <at...@numetrics.com>.
hello charlene,

for ascii code of character you could simple use java cast operation:
char c = 'A'
byte b = (byte) c;

now b should be set to 65. the ascii value of capital 'a'.

for converting a number to hex you can use Integer.toHexString(int) static
method. at the same time you can use Integer.valueOf(String, int) to convert
hex number string back to int.

hope this helps.

ATTA

----- Original Message ----- 
From: "Yan, Charlene" <Ch...@thomsonlearning.com>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Tuesday, July 22, 2003 12:26 PM
Subject: [OT]Java equivalent to ASP function


All,

I need to rewrite some ASP codes in Java.  What are the Java equivalent to
Asc(String) and Hex(Number) in VB?  I appreciate any insight from you!

Thanks.

Charlene

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org