Access Violation when accessing Dynamic Array

Jack via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Jan 2 10:05:43 PST 2016


On Saturday, 2 January 2016 at 17:56:12 UTC, tsbockman wrote:
> On Saturday, 2 January 2016 at 17:39:42 UTC, Jack wrote:
>> [...]
>
> By far the most likely explanation for an exception at that 
> location, would be if `custom_keyword` really didn't contain a 
> valid key into the `custom` associative array.
>
> So, to check I added this code:
>     writefln("custom_keyword: \"%s\"", custom_keyword);
>     stdout.flush(); // This may be required if you're running 
> the code inside an IDE.
>     readln();
> Right before `custom[custom_keyword]`.
>
> This printed the following:
>     custom_keyword: "Mario "
> Notice the extra space at the end.
>
> The solution is to use `strip()` rather than `stripLeft()`.

Thank you! I can't believe I haven't noticed the whitespace.
I should stop staying up late at night.


More information about the Digitalmars-d-learn mailing list