Converting string to ascii value

Setra roederharpo at hushmail.com
Fri Mar 7 14:21:57 PST 2014


On Friday, 7 March 2014 at 22:21:06 UTC, Setra wrote:
> Hello all! I am having trouble converting a letter in a array 
> of string to the ascii value. For example:
>
> string[] stringarray[3];
> stringarray[0] = "blahblahblah";
> stringarray[1] = "a";
> stringarray[2] = "5";
>
> long y = to!long(stringarray[2]); // makes y the value 5
> long x = to!long(stringarray[1]); // errors
>
>
> This is not working properly. I want to get the ascii value of 
> the characters.
> In this case y should equal 97, b should equal 53. How do I do 
> this properly?
> Thanks!

Whoops this is the correct version.


More information about the Digitalmars-d-learn mailing list