Error: conversion, reading from file

Michael P. baseball.mjp at gmail.com
Sun Jul 19 12:41:14 PDT 2009


bearophile Wrote:
. 
> 
> Try:
> import std.string: strip;
> ...
> highScoreList ~= toInt(strip(file[0 .. nextScore]));
> 
> I have never understand the rationale of not ignoring whitespace inside the toInt, I think it's an ugly design.
> 
> Bye,
> bearophile

That didn't work for me. Doing this:

nextScore = std.regexp.find( file, "\n" );
highScoreList ~= toInt( file[ 0 .. nextScore ] );
file = file[ nextScore + 1 .. $ ]; //changed from: file = file[ nextScore .. $ ];

Worked though.


More information about the Digitalmars-d-learn mailing list