std.array.split - Template instantiating error

Rikki Cattermole via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Apr 18 01:12:59 PDT 2015


On 18/04/2015 8:08 p.m., nrgyzer wrote:
> Hi,
>
> I've the following source:
>
> import std.array : split;
> import std.stdio : writeln;
>
> void main()
> {
>     string myString = "Hello World";
>     string[] splitted = myString.split(" ");
> }
>
> But when I compile the code above, I'm getting the following error:
>
> Error: template instance std.array.split!(string, string) error
> instantiating.
>
> I'm using the latest version of dmd (2.067.0), but I cannot figure out
> what I'm doing wrong :(. How to solve the problem?
>
> Thanks in advance!

alias immutable(char)[] string;

T[] split(T, U=typeof(T.init[0]))(T from, U sep)

Aka try changing " " to ' '.


More information about the Digitalmars-d-learn mailing list