Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
February 25, 2021 byte array to string | ||||
---|---|---|---|---|
| ||||
hi all, If i have an array: byte[3] = [1,2,3]; How to get string "123" from it? Thanks in advance. |
February 25, 2021 Re: byte array to string | ||||
---|---|---|---|---|
| ||||
Posted in reply to Mike | On Thursday, 25 February 2021 at 06:47:11 UTC, Mike wrote:
> hi all,
>
> If i have an array:
> byte[3] = [1,2,3];
>
> How to get string "123" from it?
>
> Thanks in advance.
string str = format!"%(%s)"(array);
|
February 25, 2021 Re: byte array to string | ||||
---|---|---|---|---|
| ||||
Posted in reply to FeepingCreature | On Thursday, 25 February 2021 at 06:57:57 UTC, FeepingCreature wrote:
> On Thursday, 25 February 2021 at 06:47:11 UTC, Mike wrote:
>> hi all,
>>
>> If i have an array:
>> byte[3] = [1,2,3];
>>
>> How to get string "123" from it?
>>
>> Thanks in advance.
>
> string str = format!"%(%s)"(array);
Er sorry, typo, that should be "%(%s%)". "Print the elements of the array, separated by nothing." Compare "%(%s, %)" for a comma separated list.
|
February 25, 2021 Re: byte array to string | ||||
---|---|---|---|---|
| ||||
Posted in reply to FeepingCreature | On Thursday, 25 February 2021 at 06:58:51 UTC, FeepingCreature wrote:
> On Thursday, 25 February 2021 at 06:57:57 UTC, FeepingCreature wrote:
>> On Thursday, 25 February 2021 at 06:47:11 UTC, Mike wrote:
>>> hi all,
>>>
>>> If i have an array:
>>> byte[3] = [1,2,3];
>>>
>>> How to get string "123" from it?
>>>
>>> Thanks in advance.
>>
>> string str = format!"%(%s)"(array);
>
> Er sorry, typo, that should be "%(%s%)". "Print the elements of the array, separated by nothing." Compare "%(%s, %)" for a comma separated list.
Thanks a lot.
Keep playing.
|
February 25, 2021 Re: byte array to string | ||||
---|---|---|---|---|
| ||||
Posted in reply to FeepingCreature | On 2/24/21 10:58 PM, FeepingCreature wrote: > On Thursday, 25 February 2021 at 06:57:57 UTC, FeepingCreature wrote: >> On Thursday, 25 February 2021 at 06:47:11 UTC, Mike wrote: >>> hi all, >>> >>> If i have an array: >>> byte[3] = [1,2,3]; >>> >>> How to get string "123" from it? >>> >>> Thanks in advance. >> >> string str = format!"%(%s)"(array); > > Er sorry, typo, that should be "%(%s%)". "Print the elements of the array, separated by nothing." Compare "%(%s, %)" for a comma separated list. I have an explanation of that syntax here: https://youtu.be/dRORNQIB2wA?t=981 Ali |
Copyright © 1999-2021 by the D Language Foundation