Note: This website is archived. For up-to-date information about D projects and development, please visit wiki.dlang.org.

Welcome to DData

Project Information

NameDData
CategoryServer Resources
Status4 - Beta
Short DescriptionString to Array parser module - D1 std2
Long DescriptionDData consists of a single module containing a toArray template. It takes an array in string form and return the corresponding array. As long as the base-type is supported by std2.conv.to and the depth of the array won't crash the compiler, it should work.
Forum/forums/viewforum.php?f=245
Home Page

Description

DData consists of a single module containing a toArray template full of template and string mixin fun.

It takes an array in string form and return the corresponding array.
As long as the base-type is supported by std2.conv.to and the depth of the array won't crash the compiler, it should work.

At the moment it depends on:

std2.conv.to
std2.traits.isnumeric

from:

http://www.dsource.org/projects/std2

---
Can't std.conv already do this?

Usage

unittest() 
{
    writefln("DData UnitTest...");
    
	int[][][] ia = [ [[1,2],[3,4],[5]] , [[6],[],[7,8,9]] , [[]] ];
	
	char[] s = to!(char[])(ia);
	int[][][] ia2;
	
	ia2 = toArray!(typeof(ia2))(s);
    assert( ia == ia2);  
    
    writefln("Done!");
}

Limitations

At the moment it is not made to handle arrays of strings also, its input is char[].

Starting Points

For a complete list of local wiki pages, see TitleIndex.