pseudocode for ascii to integer

This is sort of a general question, but something that might come up in a job interview.  If someone asked you to write an ascii to integer function in pseudocode for them, how would you go about doing it?
texasreddogAsked:
Who is Participating?
 
ozoConnect With a Mentor Commented:
You do not specify what kind of maping from ascii to integer you want
something as simple as
integer = ascii;
would get an integer  in many languages.
You may want  ord(substr(string,0,1)) at another level of abstraction
If you want to convert an ascii string representation of a decimal numnber, it might be something like
integer=0;
for character in string do
  integer = 10 * integer + ord(character)-ord('0')
end
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.