Files and UTF

WebFreak001 d.forum at webfreak.org
Thu Aug 6 07:24:23 UTC 2020


On Thursday, 6 August 2020 at 07:19:37 UTC, WebFreak001 wrote:
> [...]

In line 11 in my example code this makes a better, safer if than 
`if (s.length)`:
if (s.length && s[$ - 1] == '\n') s = s[0 .. $ - 1];

Note that I only need to do this because of the readln API, it 
would be much safer and more correct to instead load the whole 
file into memory in a byte[].


More information about the Digitalmars-d-learn mailing list