why there is a [] at the end of assocArray
MichaelBi
shunjie.bi at gmail.com
Wed Jan 19 23:53:16 UTC 2022
On Wednesday, 19 January 2022 at 16:36:36 UTC, Ali Çehreli wrote:
> On 1/19/22 06:06, michaelbi wrote:
>> On Wednesday, 19 January 2022 at 13:21:32 UTC, Stanislav
>> Blinov wrote:
>>> On Wednesday, 19 January 2022 at 13:15:35 UTC, michaelbi
>>> wrote:
>>>
>>>> [...]
>>>
>>>> [...]
>>>
>>> ...because there's an empty line at the end of input.txt?
>>
>> i got it, though i still don't know where the [] come from. i
>> just add strip here: a=>a.idup.strip
>
> Works for me on Linux. Perhaps there is an issue with Windows
> line endings?
>
> In any case, the .strip above would not be eliminating empty
> lines; you need to filter them out e.g. with
>
> byLine.filter!(line => !line.empty)
>
> Aside: Instead of copying the lines with .idup explicitly,
> there is .byLineCopy that already does that.
>
> Ali
I am using windows.
Thanks a lot for introducing those funcs. Now I am feeling the
D’s quite interesting and powerful :)
More information about the Digitalmars-d-learn
mailing list