Thread overview | ||||||
---|---|---|---|---|---|---|
|
February 21, 2017 Type conversions in D | ||||
---|---|---|---|---|
| ||||
I once saw an article that talked about type conversions using the D language. Type convert integer to exadecimal, binary, but I'm thinking of writing an article in my blog but I do not find the site I saw on to know more information of the same type as I did below. void main() { int a=15; writefln("O numero %s em binario é %b", a, a); } |
February 21, 2017 Re: Type conversions in D | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jean Cesar | On Tuesday, 21 February 2017 at 21:39:37 UTC, Jean Cesar wrote: > I once saw an article that talked about type conversions using the D language. > > Type convert integer to exadecimal, binary, but I'm thinking of writing an article in my blog but I do not find the site I saw on to know more information of the same type as I did below. > > void main() > { > int a=15; > > writefln("O numero %s em binario é %b", a, a); > } Note that what you are looking for is a library feature: https://dlang.org/phobos/std_conv.html In fact every type can implement its own specific format handling: https://dlang.org/phobos/std_format.html |
February 21, 2017 Re: Type conversions in D | ||||
---|---|---|---|---|
| ||||
Posted in reply to Seb | On Tuesday, 21 February 2017 at 22:09:11 UTC, Seb wrote:
> On Tuesday, 21 February 2017 at 21:39:37 UTC, Jean Cesar wrote:
>> I once saw an article that talked about type conversions using the D language.
>>
>> Type convert integer to exadecimal, binary, but I'm thinking of writing an article in my blog but I do not find the site I saw on to know more information of the same type as I did below.
>>
>> void main()
>> {
>> int a=15;
>>
>> writefln("O numero %s em binario é %b", a, a);
>> }
>
> Note that what you are looking for is a library feature:
>
> https://dlang.org/phobos/std_conv.html
>
> In fact every type can implement its own specific format handling:
>
> https://dlang.org/phobos/std_format.html
I'm not talking about it so I'm seeing what I've seen and I'm looking for things about the integer conversion operators for exa, from exa to integer etc ... I saw this once on the tutorialspoint site but I went there and I can not find any more I know if it was removed.
|
February 21, 2017 Re: Type conversions in D | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jean Cesar | On 02/21/2017 02:26 PM, Jean Cesar wrote: > On Tuesday, 21 February 2017 at 22:09:11 UTC, Seb wrote: >> On Tuesday, 21 February 2017 at 21:39:37 UTC, Jean Cesar wrote: >>> I once saw an article that talked about type conversions using the D >>> language. >>> >>> Type convert integer to exadecimal, binary, but I'm thinking of >>> writing an article in my blog but I do not find the site I saw on to >>> know more information of the same type as I did below. >>> >>> void main() >>> { >>> int a=15; >>> >>> writefln("O numero %s em binario é %b", a, a); >>> } >> >> Note that what you are looking for is a library feature: >> >> https://dlang.org/phobos/std_conv.html >> >> In fact every type can implement its own specific format handling: >> >> https://dlang.org/phobos/std_format.html > > I'm not talking about it so I'm seeing what I've seen and I'm looking > for things about the integer conversion operators for exa, from exa to > integer etc ... I saw this once on the tutorialspoint site but I went > there and I can not find any more I know if it was removed. Just for clarification, what you've originally shown is formatting: no type conversion is involved. For type conversions, this is a must read anyway: https://dlang.org/spec/type.html#integer-promotions (And "Usual Arithmetic Conversions" there.) However, I think you're talking about literal syntax: https://dlang.org/spec/lex.html#integerliteral which I had attempted to rephrase here: http://ddili.org/ders/d.en/literals.html#ix_literals.literal Ali |
Copyright © 1999-2021 by the D Language Foundation