Thread overview |
---|
June 10, 2016 How to cast ASCII value to char? | ||||
---|---|---|---|---|
| ||||
Is it possible to cast an ascii value to char? |
June 10, 2016 Re: How to cast ASCII value to char? | ||||
---|---|---|---|---|
| ||||
Posted in reply to TheDGuy | On Friday, 10 June 2016 at 14:20:16 UTC, TheDGuy wrote:
> Is it possible to cast an ascii value to char?
Yea, basically just like that: cast(char)
*sorry*
|
June 10, 2016 Re: How to cast ASCII value to char? | ||||
---|---|---|---|---|
| ||||
Posted in reply to TheDGuy | On Friday, 10 June 2016 at 14:20:16 UTC, TheDGuy wrote: > Is it possible to cast an ascii value to char? Sure! char A = cast(char) 65; // A char a = cast(char) 97; // a and back again: ubyte b = cast(ubyte) a; // 65 In general there's also an entire module (https://dlang.org/phobos/std_ascii.html) that might help you for ASCII operations ;-) |
June 10, 2016 Re: How to cast ASCII value to char? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Seb | On Friday, 10 June 2016 at 14:27:41 UTC, Seb wrote:
> On Friday, 10 June 2016 at 14:20:16 UTC, TheDGuy wrote:
>> Is it possible to cast an ascii value to char?
>
> Sure!
>
> char A = cast(char) 65; // A
> char a = cast(char) 97; // a
>
> and back again:
>
> ubyte b = cast(ubyte) a; // 65
>
> In general there's also an entire module (https://dlang.org/phobos/std_ascii.html) that might help you for ASCII operations ;-)
Thanks a lot!
|
Copyright © 1999-2021 by the D Language Foundation