On 09/03/2017 03:03 AM, ag0aep6g wrote:
> On 09/03/2017 01:39 AM, Ali Çehreli wrote:
>> If we can convert byte-by-byte, we should be able to
>> convert back byte-by-byte, right?
>
> You weren't converting byte-by-byte.
In my mind I was! :o)
> Or maybe just convert everything to UTF-8 first. That
On 09/03/2017 01:39 AM, Ali Çehreli wrote:
Ok, I see that I made a mistake but I still don't think the conversion
is one way. If we can convert byte-by-byte, we should be able to convert
back byte-by-byte, right?
You weren't converting byte-by-byte. You were only converting the
significant by
On 09/02/2017 11:02 AM, lithium iodate wrote:
> On Saturday, 2 September 2017 at 17:41:34 UTC, Ali Çehreli wrote:
>> You're right but I think there is no intention of interpreting the
>> result as UTF-8. "f62026" is just to be used as "f62026", which can be
>> converted byte-by-byte back to "ö…".
On Saturday, 2 September 2017 at 20:02:37 UTC, bitwise wrote:
On Saturday, 2 September 2017 at 18:28:02 UTC, Moritz Maxeiner
wrote:
In UTF8:
--- utfmangle.d ---
void fun_ༀ() {}
pragma(msg, fun_ༀ.mangleof);
---
---
$ dmd -c utfmangle.d
_D6mangle7fun_ༀFZv
---
Only universal cha
On Saturday, 2 September 2017 at 18:28:02 UTC, Moritz Maxeiner
wrote:
[...]
Code will eventually look something like the following.
The point is to be able to retrieve the exported function at
runtime only by knowing what the template arg would have been.
export extern(C) const(Reflection) d
On Saturday, 2 September 2017 at 18:28:02 UTC, Moritz Maxeiner
wrote:
In UTF8:
--- utfmangle.d ---
void fun_ༀ() {}
pragma(msg, fun_ༀ.mangleof);
---
---
$ dmd -c utfmangle.d
_D6mangle7fun_ༀFZv
---
Only universal character names for identifiers are allowed,
though, as per [1]
On Saturday, 2 September 2017 at 18:07:51 UTC, bitwise wrote:
On Saturday, 2 September 2017 at 17:45:30 UTC, Moritz Maxeiner
wrote:
If this (unnecessary waste) is of concern to you (and from the
fact that you used ret.reserve I assume it is), then the easy
fix is to use `sformat` instead of `
On Saturday, 2 September 2017 at 17:45:30 UTC, Moritz Maxeiner
wrote:
If this (unnecessary waste) is of concern to you (and from the
fact that you used ret.reserve I assume it is), then the easy
fix is to use `sformat` instead of `format`:
Yes, thanks. I'm going to go with a variation of y
On Saturday, 2 September 2017 at 17:41:34 UTC, Ali Çehreli wrote:
You're right but I think there is no intention of interpreting
the result as UTF-8. "f62026" is just to be used as "f62026",
which can be converted byte-by-byte back to "ö…". That's how
understand the requirement anyway.
Ali
On Saturday, 2 September 2017 at 17:41:34 UTC, Ali Çehreli wrote:
You're right but I think there is no intention of interpreting
the result as UTF-8. "f62026" is just to be used as "f62026",
which can be converted byte-by-byte back to "ö…". That's how
understand the requirement anyway.
Ali
On Saturday, 2 September 2017 at 16:23:57 UTC, bitwise wrote:
On Saturday, 2 September 2017 at 15:53:25 UTC, bitwise wrote:
[...]
This seems to work well enough.
string toAsciiHex(string str)
{
import std.array : appender;
auto ret = appender!string(null);
ret.reserve(str.length
On 09/02/2017 10:07 AM, lithium iodate wrote:
>> Lazy version, which the user can easily generate a string from by
>> appending .array:
>>
>> import std.stdio;
>>
>> auto hexString(R)(R input) {
>> import std.conv : text;
>> import std.string : format;
>> import std.algorithm : map, j
On Saturday, 2 September 2017 at 16:52:17 UTC, Ali Çehreli wrote:
On 09/02/2017 09:23 AM, bitwise wrote:
On Saturday, 2 September 2017 at 15:53:25 UTC, bitwise wrote:
[...]
This seems to work well enough.
string toAsciiHex(string str)
{
import std.array : appender;
auto ret = append
On 09/02/2017 09:23 AM, bitwise wrote:
On Saturday, 2 September 2017 at 15:53:25 UTC, bitwise wrote:
[...]
This seems to work well enough.
string toAsciiHex(string str)
{
import std.array : appender;
auto ret = appender!string(null);
ret.reserve(str.length * 2);
foreach(c; st
On Saturday, 2 September 2017 at 15:53:25 UTC, bitwise wrote:
[...]
This seems to work well enough.
string toAsciiHex(string str)
{
import std.array : appender;
auto ret = appender!string(null);
ret.reserve(str.length * 2);
foreach(c; str) ret.put(format!"%x"(c));
return r
I need to convert a string of characters to a string of their hex
representations.
"AAA" -> "414141"
This seems like something that would be in the std lib, but I
can't find it.
Does it exist?
Thanks
16 matches
Mail list logo