473,386 Members | 1,621 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

How do I get the ASCII values for a word

In my program, I have to get 2 letter from the first name. How do I get the asc values for those 2 letters.
*the letters change every time so I can't just use... for ex. ja
ord('j')
ord('a')
how would i get values for any of the letters no matter what they are??
Oct 31 '10 #1
1 2225
dwblas
626 Expert 512MB
You would pass each of the first two letters to ord. From your example, there is no way to tell anything more, but generally speaking it is simpler to work with lists instead of strings.
Expand|Select|Wrap|Line Numbers
  1. first_letter = "A"
  2. second_letter = "b"
  3. print first_letter, ord(first_letter), second_letter, ord(second_letter) 
Oct 31 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Drew | last post by:
I need to display the ASCII numeric values of each letter in a string. I think strings are stored in unicode in C# (?) I can convert the string to a char array but how do I get the ascii values...
1
by: Kermit Piper | last post by:
Hello, I have a function that lets me convert one character and throw an alert with the corresponding ASCII value, but what I am having trouble with is applying it to a text box. What I'm trying...
1
by: Kermit Piper | last post by:
Hello, OK, almost there. Here's what I have so far, which handles characters as they're typed in. Could someone please show me how I would loop through all the values that are entered if a block...
7
by: Jeffrey Spoon | last post by:
Hello, I'm a bit stuck trying to convert a text file which contains extended ASCII text and changing the ASCII values so they become readable. I do this by subtracting 127 from the ASCII value....
1
by: adnanahmed714 | last post by:
hi all i have a string <cr><lf>999,1.52,32.85,5.91,15.81,1.39,26.17,15.75,12.3 want to calculate its ASCII values sum which is equal to 2411.How can i calculate ascii sum of all the...
1
by: Bangaru | last post by:
Hi, How do SQL 2005 handle Non-ASCII values? My application is in VB 6 and SQL server 2005, and when I import non-ascii values like pound symbol, it is converted to question mark... Can...
0
by: nmsreddi | last post by:
Hi friends I am working on serialport in c# ,i am using C#2005 i have successfully done the serial communication with GSM modem and able to send and receive data , the main problem ,the serial...
10
by: manontheedge | last post by:
I want to read in an image file ( bmp, jpeg, ... ) so I can retain it's ascii / binary values, and alter the image. How can I do this in C++ ( I'm using Visual Studio, various versions ). so...
0
by: squrel | last post by:
Hello All, I have a table in my database with a field itemqty and the type was int and need to change it to decimal as i need the decimal point in my textbox.. i have a code for integer ascii...
5
by: siddhanta | last post by:
hi, i read the ascii value from a file and wrote the decimal one in other file. But values above "127" i.e. extended ascii are printed as" 65533." here ais wat i did: private void...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.