digitalmars.D.learn - AssocArray to string is ok,but how to get the AssocArray from string?
- Frank Like (17/17) Dec 12 2017 Hi,everyone,
- Azi Hassan (5/22) Dec 12 2017 Serialization seems to be the answer. Unfortunately I could
- Frank Like (3/7) Dec 14 2017 Thank you. Now,I find that works ok on string[],and not work on
- Nicholas Wilson (2/19) Dec 13 2017 Have a look at std.conv.parse
- Frank Like (5/6) Dec 14 2017 I know it.But it's not work with DateTime or SysTime.
Hi,everyone, who can help me,about the "AssocArray to string is ok,but how to get the AssocArray from string? ". For example: SysTime[][string] AATimes; AATimes["a1"] =[SysTime(DateTime(2017, 1, 1, 12, 33, 33)),SysTime(DateTime(2017, 1, 2, 12, 33, 33))]; AATimes["a2"] =[SysTime(DateTime(2017, 1, 2, 12, 33, 33)),SysTime(DateTime(2017, 1, 3, 12, 33, 33))]; ubyte[] ua = cast(ubyte[])AATimes.to!string; writeln("ua is ",ua); string strTimes = cast(string)ua; writeln("strTimes is ",strTimes); But now,how to get the AATimes from string? Thanks. Frank.
Dec 12 2017
On Tuesday, 12 December 2017 at 17:32:15 UTC, Frank Like wrote:Hi,everyone, who can help me,about the "AssocArray to string is ok,but how to get the AssocArray from string? ". For example: SysTime[][string] AATimes; AATimes["a1"] =[SysTime(DateTime(2017, 1, 1, 12, 33, 33)),SysTime(DateTime(2017, 1, 2, 12, 33, 33))]; AATimes["a2"] =[SysTime(DateTime(2017, 1, 2, 12, 33, 33)),SysTime(DateTime(2017, 1, 3, 12, 33, 33))]; ubyte[] ua = cast(ubyte[])AATimes.to!string; writeln("ua is ",ua); string strTimes = cast(string)ua; writeln("strTimes is ",strTimes); But now,how to get the AATimes from string? Thanks. Frank.Serialization seems to be the answer. Unfortunately I could neither get it to work with Cereal nor with Orange. If all else fails, you could still attempt to manually parse it ot of its string representation (AATimes.to!string).
Dec 12 2017
On Tuesday, 12 December 2017 at 21:18:19 UTC, Azi Hassan wrote:Serialization seems to be the answer. Unfortunately I could neither get it to work with Cereal nor with Orange. If all else fails, you could still attempt to manually parse it ot of its string representation (AATimes.to!string).Thank you. Now,I find that works ok on string[],and not work on SysTime[].
Dec 14 2017
On Tuesday, 12 December 2017 at 17:32:15 UTC, Frank Like wrote:Hi,everyone, who can help me,about the "AssocArray to string is ok,but how to get the AssocArray from string? ". For example: SysTime[][string] AATimes; AATimes["a1"] =[SysTime(DateTime(2017, 1, 1, 12, 33, 33)),SysTime(DateTime(2017, 1, 2, 12, 33, 33))]; AATimes["a2"] =[SysTime(DateTime(2017, 1, 2, 12, 33, 33)),SysTime(DateTime(2017, 1, 3, 12, 33, 33))]; ubyte[] ua = cast(ubyte[])AATimes.to!string; writeln("ua is ",ua); string strTimes = cast(string)ua; writeln("strTimes is ",strTimes); But now,how to get the AATimes from string? Thanks. Frank.Have a look at std.conv.parse
Dec 13 2017
On Wednesday, 13 December 2017 at 08:39:00 UTC, Nicholas Wilson wrote:Have a look at std.conv.parseI know it.But it's not work with DateTime or SysTime. Now,it's only work on string. But thank you.
Dec 14 2017