Solved

Get ascii code of a string

Posted on 2006-07-20
6
1,186 Views
Last Modified: 2007-11-27
String str="A";

How do I get the ascii code of str?
0
Comment
Question by:william007
6 Comments
 
LVL 14

Expert Comment

by:StillUnAware
ID: 17144681
Charcter.codePointAt(str, 0);
0
 
LVL 35

Accepted Solution

by:
girionis earned 400 total points
ID: 17144682
int ascii = str.charAt(0)
0
 
LVL 14

Expert Comment

by:StillUnAware
ID: 17144683
typo:

Character.codePoint(str, 0); // where 0 is the index in the str string
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 30

Expert Comment

by:Mayank S
ID: 17144749
What do you mean by ASCII code of the string? You can get ASCII code of individual characters as shown above.
0
 
LVL 24

Assisted Solution

by:sciuriware
sciuriware earned 100 total points
ID: 17144751
typo again:

     int i = Character.codePointAt(str, 0);

;JOOP!
0
 
LVL 9

Author Comment

by:william007
ID: 17264943
Thanks=)
0

Featured Post

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

679 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question