On Friday, 24 November 2023 at 09:35:00 UTC, BoQsc wrote:
I tried to look into https://dlang.org/phobos/std_conv.html
Most of the functions inside `std.conv` seem to be dependant on
[Garbage Collection](https://dlang.org/spec/garbage.html).
And I couldn't find a straightforward way to
On Tuesday, 28 November 2023 at 09:43:47 UTC, Dom DiSc wrote:
On Tuesday, 28 November 2023 at 08:51:21 UTC, Mark Davies wrote:
On Friday, 24 November 2023 at 09:35:00 UTC, BoQsc wrote:
```
import std.stdio;
char[10] longToString(long n) @nogc
```
For a 'long' 10 characters is likely to be
On Friday, 24 November 2023 at 13:05:30 UTC, Ferhat Kurtulmuş
wrote:
[...]
```
import core.stdc.stdio : sprintf;
import core.stdc.math : log10;
import std.exception : assumeUnique;
import std.stdio : writeln;
size_t nod(int num){
return cast(size_t)((num==0)?1:log10(num)+1);
}
On Tuesday, 28 November 2023 at 08:51:21 UTC, Mark Davies wrote:
I did it this way ...
You always print the full array of bytes this way. Output piped
to `od -c` is
```
000 1 2 3 4 5 377 377 377 377 377 \n - 1 2
3 4
020 5 377 377 377 377 \n
```
Those 377s
On Tuesday, 28 November 2023 at 08:51:21 UTC, Mark Davies wrote:
On Friday, 24 November 2023 at 09:35:00 UTC, BoQsc wrote:
```
import std.stdio;
char[10] longToString(long n) @nogc
```
For a 'long' 10 characters is likely to be not enough (long max
is 9223372036854775808 which has 19 chars,
On Friday, 24 November 2023 at 09:35:00 UTC, BoQsc wrote:
I tried to look into https://dlang.org/phobos/std_conv.html
Most of the functions inside `std.conv` seem to be dependant on
[Garbage Collection](https://dlang.org/spec/garbage.html).
And I couldn't find a straightforward way to
On Monday, 27 November 2023 at 12:34:30 UTC, Nick Treleaven wrote:
On Friday, 24 November 2023 at 09:35:00 UTC, BoQsc wrote:
You can use std.conv.toChars:
```d
void main() @nogc
{
int n = 515;
import std.conv;
char[10] s = 0;
auto r = n.toChars();
assert(r.length <
On Friday, 24 November 2023 at 09:35:00 UTC, BoQsc wrote:
I tried to look into https://dlang.org/phobos/std_conv.html
Most of the functions inside `std.conv` seem to be dependant on
[Garbage Collection](https://dlang.org/spec/garbage.html).
And I couldn't find a straightforward way to
On Friday, 24 November 2023 at 09:35:00 UTC, BoQsc wrote:
I tried to look into https://dlang.org/phobos/std_conv.html
Most of the functions inside `std.conv` seem to be dependant on
[Garbage Collection](https://dlang.org/spec/garbage.html).
And I couldn't find a straightforward way to
I tried to look into https://dlang.org/phobos/std_conv.html
Most of the functions inside `std.conv` seem to be dependant on
[Garbage Collection](https://dlang.org/spec/garbage.html).
And I couldn't find a straightforward way to produce a `string`
value out of `uint` value.
How to convert
10 matches
Mail list logo